Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Previous error handler not callable#32758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
* previous calls to the previousHandler would have resulted in a fatal error* boolean was saved to variable, which later would have been called in custom error_handler* left check for previous existing error_Handler* replaced result with the actually defined and callable error_handler function* replaced empty return statement by null
nicolas-grekas commentedJul 26, 2019
I'm sorry I don't get it. Can you please provide a reproducer script/app where I could see the fatal error happening? |
fancyweb commentedJul 26, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
IMHO, |
tweichart commentedJul 26, 2019
@nicolas-grekas I don't have a case or script where it fails, just having a look at the code reveals some sort of logic error here. @fancyweb actually you could change the line |
nicolas-grekas commentedJul 26, 2019
@tweichart ok thank for the feedback. To me, there is no bug here, things are as expected. If you can provide a script producing the fatal error you see, I'd be happy to be wrong. |
fancyweb commentedJul 26, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@tweichart cfhttps://3v4l.org/vYo1c
PHPStorm reports that it's a |
tweichart commentedJul 26, 2019
@fancyweb yes you're right, the |
fancyweb commentedJul 26, 2019
It can be called if there is a previous error handler (uncomment the |
xabbuh commentedJul 26, 2019
Even if it doesn't look so obvious, I am convinced that the current code works as expected. However, I have opened#32760 to rearrange some code that makes this more clear. What do you think? |
nicolas-grekas commentedJul 26, 2019
Thanks@xabbuh |
This PR was merged into the 4.2 branch.Discussion----------[HttpKernel] clarify error handler restoring process| Q | A| ------------- | ---| Branch? | 4.2| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#32758| License | MIT| Doc PR |Commits-------c1349d1 clarify error handler restoring process
Previous calls to the
$previousHandlerwould have resulted in a fatal error (see e.g. ln 512 in Kernel.php), as a boolean value was saved to the$previousHandlervariable due to thedefinedmethod. Check for method was left in place, now the actual error_handler method defined in thePHPUNIT_COMPOSER_INSTALLwill be used in case of existence.If-statement for resetting the error_handler was changed too, as there's no boolean in the variable anymore.
Apart from that a
return;was changed toreturn null;as it won't throw errors in various cases but return the same result as before.