Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4145dee

Browse files
committed
bug #52588 [Messenger] Use extension_loaded call to check if pcntl extension is loaded, as SIGTERM might be set be swoole (Sergii Dolgushev)
This PR was merged into the 6.3 branch. Discussion ---------- [Messenger] Use extension_loaded call to check if pcntl extension is loaded, as SIGTERM might be set be swoole | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #52586 | License | MIT It was assumed. that SIGTERM constant is set only by `pcntl` PHP extension. But it is also set by `swoole`. So in some cases `SIGTERM` might be set when `pcntl` is disabled but `swoole` is enabled. Commits ------- d0b4fcf Use extension_loaded call to check if pcntl extension is loaded, as SIGTERM might be set be swoole
2 parents 7398334 + d0b4fcf commit 4145dee

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
258258

259259
public function getSubscribedSignals(): array
260260
{
261-
return $this->signals ?? (\defined('SIGTERM') ? [\SIGTERM, \SIGINT] : []);
261+
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT] : []);
262262
}
263263

264264
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false

src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
134134

135135
public function getSubscribedSignals(): array
136136
{
137-
return $this->signals ?? (\defined('SIGTERM') ? [\SIGTERM, \SIGINT] : []);
137+
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT] : []);
138138
}
139139

140140
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false

src/Symfony/Component/Messenger/EventListener/StopWorkerOnSignalsListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StopWorkerOnSignalsListener implements EventSubscriberInterface
2626

2727
public function __construct(array $signals = null, LoggerInterface $logger = null)
2828
{
29-
if (null === $signals && \defined('SIGTERM')) {
29+
if (null === $signals && \extension_loaded('pcntl')) {
3030
$signals = [SIGTERM, SIGINT];
3131
}
3232
$this->signals = $signals ?? [];

src/Symfony/Component/Messenger/EventListener/StopWorkerOnSigtermSignalListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ class StopWorkerOnSigtermSignalListener extends StopWorkerOnSignalsListener
2424
{
2525
public function __construct(LoggerInterface $logger = null)
2626
{
27-
parent::__construct(\defined('SIGTERM') ? [SIGTERM] : [], $logger);
27+
parent::__construct(\extension_loaded('pcntl') ? [SIGTERM] : [], $logger);
2828
}
2929
}

0 commit comments

Comments
 (0)