From bc5f1597eb1526731662a930e3fd8aafbd7b01af Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 5 Apr 2017 19:09:25 +0200 Subject: [PATCH] Fix offset check with link ID = 0 --- application/LinkDB.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/LinkDB.php b/application/LinkDB.php index 4cee2af9..1e4d7ce8 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php @@ -144,10 +144,10 @@ public function offsetSet($offset, $value) if (!isset($value['id']) || empty($value['url'])) { die('Internal Error: A link should always have an id and URL.'); } - if ((! empty($offset) && ! is_int($offset)) || ! is_int($value['id'])) { + if (($offset !== null && ! is_int($offset)) || ! is_int($value['id'])) { die('You must specify an integer as a key.'); } - if (! empty($offset) && $offset !== $value['id']) { + if ($offset !== null && $offset !== $value['id']) { die('Array offset and link ID must be equal.'); }