From 6bd2e32615250def5affbd8a0b8e5531433106dc Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 16 Jul 2013 19:28:20 -0400 Subject: [PATCH] Remove PHP warning when there is no items to remove --- model.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/model.php b/model.php index 3a590f6..713062b 100644 --- a/model.php +++ b/model.php @@ -577,16 +577,19 @@ function update_items($feed_id, array $items) // Keep a buffer of 2 items // It's workaround for buggy feeds (cache issue with some Wordpress plugins) - $items_to_remove = array_slice($removed_items, 2); + if (is_array($removed_items)) { - if (! empty($items_to_remove)) { + $items_to_remove = array_slice($removed_items, 2); - \PicoTools\singleton('db') - ->table('items') - ->in('id', $items_to_remove) - ->eq('status', 'removed') - ->eq('feed_id', $feed_id) - ->remove(); + if (! empty($items_to_remove)) { + + \PicoTools\singleton('db') + ->table('items') + ->in('id', $items_to_remove) + ->eq('status', 'removed') + ->eq('feed_id', $feed_id) + ->remove(); + } } }