diff --git a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php index df9df09c0bc3..957a3cdb0f4c 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php @@ -65,6 +65,9 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $ */ public function configure(Event $event = null) { + if ($event instanceof ConsoleEvent && !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { + return; + } if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) { return; } @@ -148,7 +151,7 @@ public static function getSubscribedEvents() { $events = [KernelEvents::REQUEST => ['configure', 2048]]; - if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { + if (\defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { $events[ConsoleEvents::COMMAND] = ['configure', 2048]; }