diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-04-05 19:09:25 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-04-05 19:09:25 +0200 |
commit | bc5f1597eb1526731662a930e3fd8aafbd7b01af (patch) | |
tree | 2ffc6dd6b2d0130aaad219071e5271bd0aff9542 | |
parent | 2109bb9d9a355787f8beea8cbfaed2eb1d53283f (diff) | |
download | Shaarli-bc5f1597eb1526731662a930e3fd8aafbd7b01af.tar.gz Shaarli-bc5f1597eb1526731662a930e3fd8aafbd7b01af.tar.zst Shaarli-bc5f1597eb1526731662a930e3fd8aafbd7b01af.zip |
Fix offset check with link ID = 0
-rw-r--r-- | application/LinkDB.php | 4 |
1 files 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 @@ class LinkDB implements Iterator, Countable, ArrayAccess | |||
144 | if (!isset($value['id']) || empty($value['url'])) { | 144 | if (!isset($value['id']) || empty($value['url'])) { |
145 | die('Internal Error: A link should always have an id and URL.'); | 145 | die('Internal Error: A link should always have an id and URL.'); |
146 | } | 146 | } |
147 | if ((! empty($offset) && ! is_int($offset)) || ! is_int($value['id'])) { | 147 | if (($offset !== null && ! is_int($offset)) || ! is_int($value['id'])) { |
148 | die('You must specify an integer as a key.'); | 148 | die('You must specify an integer as a key.'); |
149 | } | 149 | } |
150 | if (! empty($offset) && $offset !== $value['id']) { | 150 | if ($offset !== null && $offset !== $value['id']) { |
151 | die('Array offset and link ID must be equal.'); | 151 | die('Array offset and link ID must be equal.'); |
152 | } | 152 | } |
153 | 153 | ||