diff --git a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php index a4de24b95189..a10741a84d1f 100644 --- a/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php @@ -29,28 +29,23 @@ */ final class ExceptionEvent extends RequestEvent { - /** - * The exception object. - * - * @var \Exception - */ - private $exception; + private $throwable; /** * @var bool */ private $allowCustomResponseCode = false; - public function __construct(HttpKernelInterface $kernel, Request $request, int $requestType, \Exception $e) + public function __construct(HttpKernelInterface $kernel, Request $request, int $requestType, \Throwable $e) { parent::__construct($kernel, $request, $requestType); - $this->setException($e); + $this->setThrowable($e); } - public function getException(): \Exception + public function getThrowable(): \Throwable { - return $this->exception; + return $this->throwable; } /** @@ -58,9 +53,9 @@ public function getException(): \Exception * * This exception will be thrown if no response is set in the event. */ - public function setException(\Exception $exception): void + public function setThrowable(\Throwable $exception): void { - $this->exception = $exception; + $this->throwable = $exception; } /** diff --git a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index 1e9aadac52e2..0f14c43426df 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -42,9 +42,9 @@ public function __construct($controller, LoggerInterface $logger = null, bool $d public function logKernelException(ExceptionEvent $event) { - $e = FlattenException::createFromThrowable($event->getException()); + $e = FlattenException::createFromThrowable($event->getThrowable()); - $this->logException($event->getException(), sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass(), $e->getMessage(), $e->getFile(), $e->getLine())); + $this->logException($event->getThrowable(), sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass(), $e->getMessage(), $e->getFile(), $e->getLine())); } public function onKernelException(ExceptionEvent $event, string $eventName = null, EventDispatcherInterface $eventDispatcher = null) @@ -53,7 +53,7 @@ public function onKernelException(ExceptionEvent $event, string $eventName = nul return; } - $exception = $event->getException(); + $exception = $event->getThrowable(); $request = $this->duplicateRequest($exception, $event->getRequest()); try { @@ -98,7 +98,7 @@ public static function getSubscribedEvents(): array ]; } - protected function logException(\Exception $exception, string $message) + protected function logException(\Throwable $exception, string $message) { if (null !== $this->logger) { if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { @@ -112,7 +112,7 @@ protected function logException(\Exception $exception, string $message) /** * Clones the request for the exception. */ - protected function duplicateRequest(\Exception $exception, Request $request): Request + protected function duplicateRequest(\Throwable $exception, Request $request): Request { $attributes = [ '_controller' => $this->controller, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy