From 6c95d7fe170a54449755a8b571a191a3aaaf954e Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 3 Dec 2016 22:32:08 +0100 Subject: [PATCH 1/1] Do not crash status page when gearman worker is not registered --- src/phinde/Queue.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/phinde/Queue.php b/src/phinde/Queue.php index 1033d7a..a8ead3d 100644 --- a/src/phinde/Queue.php +++ b/src/phinde/Queue.php @@ -43,10 +43,14 @@ class Queue $cmd = 'gearadmin --status' . '| grep ' . escapeshellarg($this->queueName); $line = exec($cmd); - - $parts = preg_split('#\s+#', $line); - if (count($parts) !== 4) { - throw new \Exception('gearadmin status line does not have 4 parts'); + if ($line === '') { + //job not registered + $parts = [0, -1, -1, -1]; + } else { + $parts = preg_split('#\s+#', $line); + if (count($parts) !== 4) { + throw new \Exception('gearadmin status line does not have 4 parts'); + } } return array( -- 2.30.2