8000 [HttpKernel] avoid hidding exceptions set in exception listeners (see… · symfony/symfony@295860d · GitHub
[go: up one dir, main page]

Skip to content

Commit 295860d

Browse files
committed
[HttpKernel] avoid hidding exceptions set in exception listeners (see the Security ExceptionListener for some examples)
1 parent bd18907 commit 295860d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function onKernelException(GetResponseForExceptionEvent $event)
9090
$handling = false;
9191

9292
// re-throw the exception as this is a catch-all
93-
throw $exception;
93+
return;
9494
}
9595

9696
$event->setResponse($response);

src/Symfony/Component/HttpKernel/HttpKernel.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ private function handleException(\Exception $e, $request, $type)
184184
$event = new GetResponseForExceptionEvent($this, $request, $type, $e);
185185
$this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event);
186186

187+
// a listener might have replaced the exception
188+
$e = $event->getException();
189+
187190
if (!$event->hasResponse()) {
188191
throw $e;
189192
}

0 commit comments

Comments
 (0)
0