From 633a71ec970ab23a47838705fe951df1e9a8cea9 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 1 Jul 2018 14:46:45 -0400 Subject: [PATCH] Fix notice in Item::deleteById --- src/Model/Item.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 5d858fa72b..052d402127 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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