-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
I'm sorry I don't get it. Can you please provide a reproducer script/app where I could see the fatal error happening? |
IMHO, |
@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 |
@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. |
@tweichart cf https://3v4l.org/vYo1c
PHPStorm reports that it's a |
@fancyweb yes you're right, the |
It can be called if there is a previous error handler (uncomment the |
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? |
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
$previousHandler
would have resulted in a fatal error (see e.g. ln 512 in Kernel.php), as a boolean value was saved to the$previousHandler
variable due to thedefined
method. Check for method was left in place, now the actual error_handler method defined in thePHPUNIT_COMPOSER_INSTALL
will 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.