Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b4ed15a

Browse files
bug #21064 [Debug] Wrap call to ->log in a try catch block (lyrixx)
This PR was merged into the 2.7 branch. Discussion ---------- [Debug] Wrap call to ->log in a try catch block | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | --- If something goes wrong in the logger, the application ends up with a blank page. Let's display the original exception. Commits ------- 18dfef1 [Debug] Wrap call to ->log in a try catch block
2 parents ee69018 + 18dfef1 commit b4ed15a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/Debug/ErrorHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,11 @@ public function handleException($exception, array $error = null)
504504
}
505505
}
506506
if ($this->loggedErrors & $type) {
507-
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
507+
try {
508+
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
509+
} catch (\Exception $handlerException) {
510+
} catch (\Throwable $handlerException) {
511+
}
508512
}
509513
if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
510514
foreach ($this->getFatalErrorHandlers() as $handler) {

0 commit comments

Comments
 (0)