From 781e4f19082204bd8e68e7149326beb58811e5b1 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Sun, 11 Jun 2017 12:58:53 +0200 Subject: [PATCH] [FeedExpander] Deal with empty item --- lib/FeedExpander.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/FeedExpander.php b/lib/FeedExpander.php index 1d0612d..b45a46f 100644 --- a/lib/FeedExpander.php +++ b/lib/FeedExpander.php @@ -48,7 +48,10 @@ abstract class FeedExpander extends BridgeAbstract { $this->load_RSS_2_0_feed_data($rssContent->channel[0]); foreach($rssContent->item as $item){ debugMessage('parsing item ' . var_export($item, true)); - $this->items[] = $this->parseItem($item); + $tmp_item = $this->parseItem($item); + if (!empty($tmp_item)) { + $this->items[] = $tmp_item; + } if($maxItems !== -1 && count($this->items) >= $maxItems) break; } } @@ -62,7 +65,10 @@ abstract class FeedExpander extends BridgeAbstract { $this->load_RSS_2_0_feed_data($rssContent); foreach($rssContent->item as $item){ debugMessage('parsing item ' . var_export($item, true)); - $this->items[] = $this->parseItem($item); + $tmp_item = $this->parseItem($item); + if (!empty($tmp_item)) { + $this->items[] = $tmp_item; + } if($maxItems !== -1 && count($this->items) >= $maxItems) break; } } @@ -71,7 +77,10 @@ abstract class FeedExpander extends BridgeAbstract { $this->load_ATOM_feed_data($content); foreach($content->entry as $item){ debugMessage('parsing item ' . var_export($item, true)); - $this->items[] = $this->parseItem($item); + $tmp_item = $this->parseItem($item); + if (!empty($tmp_item)) { + $this->items[] = $tmp_item; + } if($maxItems !== -1 && count($this->items) >= $maxItems) break; } }