From 18dfef1e2b5cd84035532de94823ed5a9a2bbc46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Tue, 27 Dec 2016 15:47:08 +0100 Subject: [PATCH] [Debug] Wrap call to ->log in a try catch block If something goes wrong in the logger, the application ends up with a blank page. Let's display the original exception. --- src/Symfony/Component/Debug/ErrorHandler.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 9d8ab8060f..8c664c54f9 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -504,7 +504,11 @@ class ErrorHandler } } 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) {