From dd0aa4796e8558fb74d84a94a78a24fe45ce92e9 Mon Sep 17 00:00:00 2001 From: Yuri Karaban Date: Mon, 19 Aug 2024 23:13:38 +0300 Subject: [PATCH 1/2] require PHP 7.3.0+ --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0fd2f70..334236d 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": ">=7.1.0", + "php": ">=7.3.0", "ext-pcntl": "*", "ext-posix": "*", "ext-sysvsem": "*", From 139a17b3a9d3b206d397226de0f7ecb41abfea59 Mon Sep 17 00:00:00 2001 From: Yuri Karaban Date: Mon, 19 Aug 2024 23:13:50 +0300 Subject: [PATCH 2/2] array_shift is unsafe for irregularly indexed array --- src/ProcessDetailsCollection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ProcessDetailsCollection.php b/src/ProcessDetailsCollection.php index e34630b..4068e66 100644 --- a/src/ProcessDetailsCollection.php +++ b/src/ProcessDetailsCollection.php @@ -122,7 +122,8 @@ public function takeFreeProcess() : ?ProcessDetails { if ($this->getFreeProcessesCount() === 0) { return NULL; } - $freePid = array_shift($this->freeProcessIds); + $freePid = array_key_first($this->freeProcessIds); + unset($this->freeProcessIds[$freePid]); if ($freePid === NULL) { return NULL; }