Issue #2187233 by eelkeblok: Aggregator fails when a feed item contains an empty description.

8.0.x
Alex Pott 2014-02-13 12:29:18 +00:00
parent 12953f2eaf
commit 134cfbe435
3 changed files with 33 additions and 5 deletions

View File

@ -169,8 +169,14 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
$entry->setFeedId($feed->id());
$entry->setLink($item['link']);
$entry->setDescription($item['description']);
$entry->setGuid($item['guid']);
$description = '';
if (!empty($item['description'])) {
$description = $item['description'];
}
$entry->setDescription($description);
$entry->save();
}
}

View File

@ -38,10 +38,11 @@ class RemoveFeedItemTest extends AggregatorTestBase {
$feed = $this->createFeed($feed_url);
// Update and remove items two times in a row to make sure that removal
// resets all 'modified' information (modified, etag, hash) and allows for
// immediate update.
$this->updateAndRemove($feed, 4);
$this->updateAndRemove($feed, 4);
$this->updateAndRemove($feed, 4);
// immediate update. There's 8 items in the feed, but one has an empty
// title and is skipped.
$this->updateAndRemove($feed, 7);
$this->updateAndRemove($feed, 7);
$this->updateAndRemove($feed, 7);
// Delete feed.
$this->deleteFeed($feed);
}

View File

@ -37,5 +37,26 @@
<author>I wanted to get out and walk eastward toward the park through the soft twilight, but each time I tried to go I became entangled in some wild, strident argument which pulled me back, as if with ropes, into my chair. Yet high over the city our line of yellow windows must have contributed their share of human secrecy to the casual watcher in the darkening streets, and I was him too, looking up and wondering. I was within and without, simultaneously enchanted and repelled by the inexhaustible variety of life.</author>
<description>Long author feed item description.</description>
</item>
<item>
<title></title>
<link>http://example.com/empty/title</link>
<description>This is an item with an empty title.</description>
</item>
<item>
<title>Empty description feed item title.</title>
<link>http://example.com/empty/description</link>
<description></description>
</item>
<item>
<title>Empty link feed item title.</title>
<link></link>
<description>This is an item with an empty link.</description>
</item>
<item>
<title>Empty author feed item title.</title>
<link>http://example.com/empty/author</link>
<author></author>
<description>We've tested items with no author, but what about an empty author tag?</description>
</item>
</channel>
</rss>