bug #35718 [HttpKernel] fix registering DebugHandlersListener regardless of the PHP_SAPI (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] fix registering DebugHandlersListener regardless of the PHP_SAPI

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/35579#issuecomment-581653196
| License       | MIT
| Doc PR        | -

Commits
-------

3f995ac602 [HttpKernel] fix registering DebugHandlersListener regardless of the PHP_SAPI
This commit is contained in:
Fabien Potencier 2020-02-15 08:17:43 +01:00
commit 926e19ce32

View File

@ -65,6 +65,9 @@ class DebugHandlersListener implements EventSubscriberInterface
*/
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 @@ class DebugHandlersListener implements EventSubscriberInterface
{
$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];
}