From a79247a30c9d1ed9a5fb8190fcb40536e8d7b2c5 Mon Sep 17 00:00:00 2001 From: Lars van Erp <43091121+larsverp@users.noreply.github.com> Date: Wed, 4 Aug 2021 16:35:26 +0200 Subject: [PATCH] Fixed the bug where grocy would return "Not a grocycode" all the time (#1557) --- helpers/Grocycode.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helpers/Grocycode.php b/helpers/Grocycode.php index 3f9af599..bfafeaf5 100644 --- a/helpers/Grocycode.php +++ b/helpers/Grocycode.php @@ -77,7 +77,7 @@ class Grocycode $gc = new self($code); return true; } - catch (Exception $e) + catch (\Exception $e) { return false; } @@ -110,7 +110,7 @@ class Grocycode */ private function setFromCode($code) { - $parts = array_reverse(explode(':', $barcode)); + $parts = array_reverse(explode(':', $code)); if (array_pop($parts) != self::MAGIC) { throw new \Exception('Not a grocycode'); @@ -122,7 +122,7 @@ class Grocycode } $this->id = array_pop($parts); - $this->extra_data = array_reverse($parse); + $this->extra_data = array_reverse($parts); } /**