Skip to content

Commit

Permalink
[Debug] Wrap call to ->log in a try catch block
Browse files Browse the repository at this point in the history
If something goes wrong in the logger, the application ends up
with a blank page. Let's display the original exception.
  • Loading branch information
lyrixx committed Dec 27, 2016
1 parent ee69018 commit 18dfef1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Symfony/Component/Debug/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,11 @@ public function handleException($exception, array $error = null)
}
}
if ($this->loggedErrors & $type) {
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
try {
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
} catch (\Exception $handlerException) {
} catch (\Throwable $handlerException) {
}
}
if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
foreach ($this->getFatalErrorHandlers() as $handler) {
Expand Down

0 comments on commit 18dfef1

Please sign in to comment.