]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Fix offset check with link ID = 0 844/head
authorArthurHoaro <arthur@hoa.ro>
Wed, 5 Apr 2017 17:09:25 +0000 (19:09 +0200)
committerArthurHoaro <arthur@hoa.ro>
Wed, 5 Apr 2017 17:09:25 +0000 (19:09 +0200)
application/LinkDB.php

index 4cee2af9942559fd122189687058ddddc1fc4ebf..1e4d7ce88421aa8871264487ddf329f87e4e2d15 100644 (file)
@@ -144,10 +144,10 @@ class LinkDB implements Iterator, Countable, ArrayAccess
         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.');
         }