DF is 2.3.1
I ought to say that this error in particular is e-mail related, but its reason may influence other places in php code, which calls file_exists function with arbitrary long argument to distinguish if it should be interpreted as an actual file or rather as a string.
As soon as I use registerUser API, I get an error response, like
{
“error”: {
“context”: null,
“message”: “Error processing user confirmation.\nfile_exists(): File name is longer than the maximum allowed path length on this platform (1024): <DF_basepath>/resources/views/<Here goes an entire e-mail contents>.blade.php”,
“code”: 500
}
}
As far as I see, OS on my DSP’s server (FreeBSD, if I’m correct) restricts maximum length of a file name by 1024 symbols, which easily may be overflown by a generated e-mail text string.
Somewhere in php code (I wonder where it is…) file_exists is called, and instead of file name, the e-mail text is passes as a parameter. Of course, if not for filename limit, code would choose file_exists===false execution branch. But in my case, a php exception is thrown, aborting anything, that may follow otherwise.
I’ve already fixed an error like this somewhere in the previous DF version, that time, related to custom server scripting, script text refused to save, due to the same reason - it was passed to file_exists, its length was greate than 1024, an exception was thrown, etc.
I do not know how to gracefully work around this big. What I did, just added a simple check, if parameter length was less than 1024, then called file_exists.
But, unlike the case with script thext handling, this time I am not able to locate the right php source, where email sending is handled.
PS. Jee-sus. Hallelujah! This House Is Clean!
Ok, unfortunately for me, I had to change vendor/laravel/framework/src/Illuminate/Filesystem.php. Method “exists($path)” line 21.
Changed it to temporarily switch off any error handling before calling file_exists, then re-enabled it afterwards.
public function exists($path)
{
$ok = false;
try
{
set_error_handler( function() {/* ignore errors */} );
$ok = file_exists($path);
}
catch(Exception $ex)
{
}
restore_error_handler();
return $ok;
}