-
-
Notifications
You must be signed in to change notification settings - Fork 23
Wrong if condition handlingin controller/boostrap.php #93
Comments
I don't think so. The function must only be defined if it does not yet exist, mustn't it? |
Yes you're right that was my mistake. But if you execute the original code on a system where posix_getpwuid isn't enabled, you get the described server error 500. Whit the changed code the error wont appear. |
What is written into the server log file when the error occurs? |
|
This error has been around for a long time. See https://community.contao.org/de/showthread.php?8940-System-Check-Fatal-error-posix_getpwuid&p=76537&viewfull=1#post76537 for one possible workaround for example. |
Your "workaround" is not really a workaround. You might as well remove the function declaration completely, because |
Well it's not 'my' workaround - but the issue has been around for that long. Yes, the issue is probably a duplicate of #86 - however, that issue was closed by the reporter. |
Correct, because a PHP update apparently solved the issue. (Which would indicate a PHP bug.) |
Indeed. However, I have no idea under which conditions (specific PHP version, specific PHP build of specific Linux distris) this issue might be caused. It just happens to pop up every now and again on various hosters/systems. |
It can also happen if the function is disabled for security reasons, see error:
Then the |
So what's the status on this issue? |
So for my opinion it could be closed. I solved it for the corresponding server, but this was the first and only one with this error. |
If the only cause of this issue is if (!function_exists('posix_getpwuid') && !in_array('posix_getpwuid', explode(',', ini_get('disable_functions')))) {
function posix_getpwuid($int) {
return array('name'=>$int);
}
} Then you'll get at least a more useful warning: instead of
|
I assume you have copied this "solution" from the PHP manual? Did you realize that both these answers have been downvoted? This is actually a PHP bug, which has been fixed already: https://bugs.php.net/bug.php?id=69297&edit=3 |
No, I did not copy that from anywhere. My "solution" simply prevents the redeclaration of The PHP bug you referred to is something else entirely and has nothing to do with this issue. |
The problem occurs under PHP As long as |
Which does not improve anything at all! You are just exchanging one error message with another. |
I know, but, as I said, at least then you are getting a warning telling you what the actual problem is. Of course you could also simply do if (in_array('posix_getpwuid', explode(',', ini_get('disable_functions'))))
{
die("'posix_getpwuid' must not be in 'disable_functions'");
} or something better. In any case, the fatal error should be avoided somehow. |
The Contao Check is supposed to be able to run on most configurations without generating a Fatal Error (or die for that matter…) - since it is used to determine whether the respective environment meets the minimum requirements for Contao amongst other things (like installing Contao and validating an existing installation). Thus, instead of generating a fatal error (current situation), a warning or just a This way, a regular User using the Contao Check will more likely know what to do. |
I think the following code block is wrong, because the function is triggered when it doesn't exist and causes an server error 500.
It should be
The text was updated successfully, but these errors were encountered: