From 6b295915fd42a51bdb8e65410faf589e6851c29c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 8 Aug 2022 09:18:14 +0200 Subject: [PATCH] fix dispatch signal event check for compatibility with the contract interface --- src/Symfony/Component/Console/Application.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 82f75d4fc6a60..991c94d95ff2d 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -985,9 +985,8 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI if ($this->signalsToDispatchEvent) { $commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : []; - $dispatchSignals = $this->dispatcher && $this->dispatcher->hasListeners(ConsoleEvents::SIGNAL); - if ($commandSignals || $dispatchSignals) { + if ($commandSignals || null !== $this->dispatcher) { if (!$this->signalRegistry) { throw new RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.'); } @@ -1007,7 +1006,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI } } - if ($dispatchSignals) { + if (null !== $this->dispatcher) { foreach ($this->signalsToDispatchEvent as $signal) { $event = new ConsoleSignalEvent($command, $input, $output, $signal);