aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-04-05 19:38:25 +0200
committerGitHub <noreply@github.com>2017-04-05 19:38:25 +0200
commitc8cb5c282402e3f19497ba9e57ac967a4bdefa1b (patch)
tree2ffc6dd6b2d0130aaad219071e5271bd0aff9542
parent2109bb9d9a355787f8beea8cbfaed2eb1d53283f (diff)
parentbc5f1597eb1526731662a930e3fd8aafbd7b01af (diff)
downloadShaarli-c8cb5c282402e3f19497ba9e57ac967a4bdefa1b.tar.gz
Shaarli-c8cb5c282402e3f19497ba9e57ac967a4bdefa1b.tar.zst
Shaarli-c8cb5c282402e3f19497ba9e57ac967a4bdefa1b.zip
Merge pull request #844 from ArthurHoaro/hotfix/id-0
Fix offset check with link ID = 0
-rw-r--r--application/LinkDB.php4
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