bug #25829 [Debug] Always decorate existing exception handlers to deal with fatal errors (nicolas-grekas)
This PR was merged into the 2.7 branch.
Discussion
----------
[Debug] Always decorate existing exception handlers to deal with fatal errors
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #25827
| License | MIT
| Doc PR | -
Decorating the exception is seamless, let's always do it and fix handling of fatal errors.
Related to #25408 also.
Commits
-------
205d7ae3f7
[Debug] Always decorate existing exception handlers to deal with fatal errors
This commit is contained in:
commit
78a8a63450
@ -147,11 +147,14 @@ class ErrorHandler
|
|||||||
$handler = $prev[0];
|
$handler = $prev[0];
|
||||||
$replace = false;
|
$replace = false;
|
||||||
}
|
}
|
||||||
if ($replace || !$prev) {
|
if (!$replace && $prev) {
|
||||||
$handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
|
|
||||||
} else {
|
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
}
|
}
|
||||||
|
if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] === $handler) {
|
||||||
|
restore_exception_handler();
|
||||||
|
} else {
|
||||||
|
$handler->setExceptionHandler($prev);
|
||||||
|
}
|
||||||
|
|
||||||
$handler->throwAt($levels & $handler->thrownErrors, true);
|
$handler->throwAt($levels & $handler->thrownErrors, true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user