Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 78a8a63

Browse filesBrowse files
committed
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 ------- 205d7ae [Debug] Always decorate existing exception handlers to deal with fatal errors
2 parents 5d39415 + 205d7ae commit 78a8a63
Copy full SHA for 78a8a63

File tree

1 file changed

+6
-3
lines changed
Filter options

1 file changed

+6
-3
lines changed

‎src/Symfony/Component/Debug/ErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/ErrorHandler.php
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,14 @@ public static function register($handler = null, $replace = true)
147147
$handler = $prev[0];
148148
$replace = false;
149149
}
150-
if ($replace || !$prev) {
151-
$handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
152-
} else {
150+
if (!$replace && $prev) {
153151
restore_error_handler();
154152
}
153+
if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] === $handler) {
154+
restore_exception_handler();
155+
} else {
156+
$handler->setExceptionHandler($prev);
157+
}
155158

156159
$handler->throwAt($levels & $handler->thrownErrors, true);
157160

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.