]> git.mxchange.org Git - friendica.git/commitdiff
Fix notice in Item::deleteById
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 1 Jul 2018 18:46:45 +0000 (14:46 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Mon, 2 Jul 2018 11:49:35 +0000 (07:49 -0400)
src/Model/Item.php

index 5d858fa72b0cdf436651ee2df6d0cdbe4a59e9c2..052d402127cc7338ac54003b039f523fb4d12307 100644 (file)
@@ -801,7 +801,9 @@ class Item extends BaseObject
                // If item has attachments, drop them
                foreach (explode(", ", $item['attach']) as $attach) {
                        preg_match("|attach/(\d+)|", $attach, $matches);
-                       dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
+                       if (is_array($matches) && count($matches) > 1) {
+                               dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
+                       }
                }
 
                // Delete tags that had been attached to other items