Skip to content

Commit 0bb6367

Browse files
[HttpKernel] fix registering DebugHandlersListener regardless of the PHP_SAPI
1 parent de64b09 commit 0bb6367

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

EventListener/DebugHandlersListener.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
6565
*/
6666
public function configure(Event $event = null)
6767
{
68+
if ($event instanceof ConsoleEvent && !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
69+
return;
70+
}
6871
if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) {
6972
return;
7073
}
@@ -148,7 +151,7 @@ public static function getSubscribedEvents()
148151
{
149152
$events = [KernelEvents::REQUEST => ['configure', 2048]];
150153

151-
if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
154+
if (\defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
152155
$events[ConsoleEvents::COMMAND] = ['configure', 2048];
153156
}
154157

0 commit comments

Comments
 (0)