8000 [HttpKernel] Configure the ErrorHandler even when it is overriden · symfony/symfony@31817b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 31817b4

Browse files
[HttpKernel] Configure the ErrorHandler even when it is overriden
1 parent 10f3b10 commit 31817b4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
*/
3434
class DebugHandlersListener implements EventSubscriberInterface
3535
{
36+
private $earlyHandler;
3637
private $exceptionHandler;
3738
private $logger;
3839
private $levels;
@@ -53,6 +54,10 @@ class DebugHandlersListener implements EventSubscriberInterface
5354
*/
5455
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true)
5556
{
57+
$handler = set_exception_handler('var_dump');
58+
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
59+
restore_exception_handler();
60+
5661
$this->exceptionHandler = $exceptionHandler;
5762
$this->logger = $logger;
5863
$this->levels = null === $levels ? \E_ALL : $levels;
@@ -79,6 +84,10 @@ public function configure(Event $event = null)
7984
$handler = \is_array($handler) ? $handler[0] : null;
8085
restore_exception_handler();
8186

87+
if (!$handler instanceof ErrorHandler && !$handler instanceof LegacyErrorHandler) {
88+
$handler = $this->earlyHandler;
89+
}
90+
8291
if ($this->logger || null !== $this->throwAt) {
8392
if ($handler instanceof ErrorHandler || $handler instanceof LegacyErrorHandler) {
8493
if ($this->logger) {

0 commit comments

Comments
 (0)
0