Skip to content

Commit 974f9d6

Browse files
authored
Fix #414: Fixed PHP errors when PCNTL functions were disallowed
1 parent 7d12073 commit 974f9d6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Yii2 Queue Extension Change Log
44
2.3.2 under development
55
-----------------------
66

7-
- no changes in this release.
7+
- Bug #414: Fixed PHP errors when PCNTL functions were disallowed (brandonkelly)
88

99

1010
2.3.1 December 23, 2020

src/cli/SignalLoop.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct($queue, array $config = [])
6969
public function init()
7070
{
7171
parent::init();
72-
if (extension_loaded('pcntl')) {
72+
if (extension_loaded('pcntl') && function_exists('pcntl_signal')) {
7373
foreach ($this->exitSignals as $signal) {
7474
pcntl_signal($signal, function () {
7575
self::$exit = true;
@@ -95,7 +95,7 @@ public function init()
9595
*/
9696
public function canContinue()
9797
{
98-
if (extension_loaded('pcntl')) {
98+
if (extension_loaded('pcntl') && function_exists('pcntl_signal_dispatch')) {
9999
pcntl_signal_dispatch();
100100
// Wait for resume signal until loop is suspended
101101
while (self::$pause && !self::$exit) {

src/drivers/amqp_interop/Queue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function init()
224224
$this->close();
225225
});
226226

227-
if (extension_loaded('pcntl') && PHP_MAJOR_VERSION >= 7) {
227+
if (extension_loaded('pcntl') && function_exists('pcntl_signal') && PHP_MAJOR_VERSION >= 7) {
228228
// https://github.com/php-amqplib/php-amqplib#unix-signals
229229
$signals = [SIGTERM, SIGQUIT, SIGINT, SIGHUP];
230230

0 commit comments

Comments
 (0)