From 24dd55bbff322e6c4bf2b53aaa977939b9aea81d Mon Sep 17 00:00:00 2001 From: Andrew Male Date: Wed, 5 Jan 2022 23:20:26 -0500 Subject: [PATCH 1/3] Adding guard for Windows bin paths with spaces --- src/GO/Scheduler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GO/Scheduler.php b/src/GO/Scheduler.php index 0c5fba6..bb8a763 100644 --- a/src/GO/Scheduler.php +++ b/src/GO/Scheduler.php @@ -126,6 +126,10 @@ public function php($script, $bin = null, $args = [], $id = null) $bin = $bin !== null && is_string($bin) && file_exists($bin) ? $bin : (PHP_BINARY === '' ? '/usr/bin/php' : PHP_BINARY); + if (PHP_OS_FAMILY == 'Windows' && stripos($bin, ' ') !== false) { + $bin = '"{$bin}"'; + } + $job = new Job($bin . ' ' . $script, $args, $id); if (! file_exists($script)) { From 110982158e830ec6e14190758faed4788138acfd Mon Sep 17 00:00:00 2001 From: Andrew Male Date: Wed, 5 Jan 2022 23:21:34 -0500 Subject: [PATCH 2/3] Fixing indentation to spaces --- src/GO/Scheduler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GO/Scheduler.php b/src/GO/Scheduler.php index bb8a763..5d68b3c 100644 --- a/src/GO/Scheduler.php +++ b/src/GO/Scheduler.php @@ -126,9 +126,9 @@ public function php($script, $bin = null, $args = [], $id = null) $bin = $bin !== null && is_string($bin) && file_exists($bin) ? $bin : (PHP_BINARY === '' ? '/usr/bin/php' : PHP_BINARY); - if (PHP_OS_FAMILY == 'Windows' && stripos($bin, ' ') !== false) { - $bin = '"{$bin}"'; - } + if (PHP_OS_FAMILY == 'Windows' && stripos($bin, ' ') !== false) { + $bin = '"{$bin}"'; + } $job = new Job($bin . ' ' . $script, $args, $id); From a67c0e0015aacc5feefe33779a187d17710b20c6 Mon Sep 17 00:00:00 2001 From: Andrew Male Date: Fri, 13 Oct 2023 19:57:00 -0400 Subject: [PATCH 3/3] Update src/GO/Scheduler.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marek Bartoš --- src/GO/Scheduler.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/GO/Scheduler.php b/src/GO/Scheduler.php index 5d68b3c..8eac230 100644 --- a/src/GO/Scheduler.php +++ b/src/GO/Scheduler.php @@ -126,9 +126,7 @@ public function php($script, $bin = null, $args = [], $id = null) $bin = $bin !== null && is_string($bin) && file_exists($bin) ? $bin : (PHP_BINARY === '' ? '/usr/bin/php' : PHP_BINARY); - if (PHP_OS_FAMILY == 'Windows' && stripos($bin, ' ') !== false) { - $bin = '"{$bin}"'; - } + $bin = escapeshellarg($bin); $job = new Job($bin . ' ' . $script, $args, $id);