8000 Tweak error/exception handler registration · symfony/symfony@a667f57 · GitHub
[go: up one dir, main page]

Skip to content

Commit a667f57

Browse files
nicolas-grekasxabbuh
authored andcommitted
Tweak error/exception handler registration
1 parent 0bf9965 commit a667f57

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,12 @@ public function boot(): void
9595
{
9696
$_ENV['DOCTRINE_DEPRECATIONS'] = $_SERVER['DOCTRINE_DEPRECATIONS'] ??= 'trigger';
9797

98-
$handler = ErrorHandler::register(null, false);
98+
$handler = set_error_handler('var_dump');
99+
restore_error_handler();
99100

100-
$this->container->get('debug.error_handler_configurator')->configure($handler);
101+
if (\is_array($handler) && $handler[0] instanceof ErrorHandler) {
102+
$this->container->get('debug.error_handler_configurator')->configure($handler);
103+
}
101104

102105
if ($this->container->getParameter('kernel.http_method_override')) {
103106
Request::enableHttpMethodParameterOverride();

src/Symfony/Component/Console/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ public function run(?InputInterface $input = null, ?OutputInterface $output = nu
161161
}
162162
}
163163

164-
$this->configureIO($input, $output);
165-
166164
try {
165+
$this->configureIO($input, $output);
166+
167167
$exitCode = $this->doRun($input, $output);
168168
} catch (\Throwable $e) {
169169
if ($e instanceof \Exception && !$this->catchExceptions) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(?callable $exceptionHandler = null, bool|LoggerInter
4747
// BC with Symfony 5
4848
$webMode = null;
4949
}
50-
$handler = set_exception_handler('is_int');
50+
$handler = set_exception_handler('var_dump');
5151
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
5252
restore_exception_handler();
5353

@@ -94,7 +94,7 @@ public function configure(?object $event = null): void
9494
}
9595
}
9696
if ($this->exceptionHandler) {
97-
$handler = set_exception_handler(static fn () => null);
97+
$handler = set_exception_handler('var_dump');
9898
$handler = \is_array($handler) ? $handler[0] : null;
9999
restore_exception_handler();
100100

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ public function onKernelException(ExceptionEvent $event): void
8484

8585
$throwable = $event->getThrowable();
8686

87-
if ($exceptionHandler = set_exception_handler(var_dump(...))) {
88-
restore_exception_handler();
89-
if (\is_array($exceptionHandler) && $exceptionHandler[0] instanceof ErrorHandler) {
90-
$throwable = $exceptionHandler[0]->enhanceError($event->getThrowable());
91-
}
87+
$exceptionHandler = set_exception_handler('var_dump');
88+
restore_exception_handler();
89+
90+
if (\is_array($exceptionHandler) && $exceptionHandler[0] instanceof ErrorHandler) {
91+
$throwable = $exceptionHandler[0]->enhanceError($event->getThrowable());
9292
}
9393

9494
$request = $this->duplicateRequest($throwable, $event->getRequest());

0 commit comments

Comments
 (0)
0