diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php index 7f5584fa7f..27421f525f 100755 --- a/lib/Fetcher/FeedFetcher.php +++ b/lib/Fetcher/FeedFetcher.php @@ -234,6 +234,7 @@ protected function buildItem(ItemInterface $parsedItem, ?string $body = null, bo $item = new Item(); $item->setUnread(true); $itemLink = $parsedItem->getLink(); + $itemTitle = $parsedItem->getTitle(); $item->setUrl($itemLink); $publicId = $parsedItem->getPublicId(); if ($publicId == null) { @@ -241,7 +242,7 @@ protected function buildItem(ItemInterface $parsedItem, ?string $body = null, bo $this->logger->debug( "Feed item {title} with link {link} did not expose a guid, falling back to using link as guid", [ - 'title' => $parsedItem->getTitle(), + 'title' => $itemTitle, 'link' => $itemLink ] ); @@ -268,8 +269,8 @@ protected function buildItem(ItemInterface $parsedItem, ?string $body = null, bo $item->setRtl($RTL); // unescape content because angularjs helps against XSS - if ($parsedItem->getTitle() !== null) { - $item->setTitle($this->decodeTwice($parsedItem->getTitle())); + if ($itemTitle !== null) { + $item->setTitle($this->decodeTwice($itemTitle)); } $author = $parsedItem->getAuthor(); if ($author !== null && $author->getName() !== null) { diff --git a/tests/Unit/Fetcher/FeedFetcherTest.php b/tests/Unit/Fetcher/FeedFetcherTest.php index 04e86f1b4f..af80661711 100644 --- a/tests/Unit/Fetcher/FeedFetcherTest.php +++ b/tests/Unit/Fetcher/FeedFetcherTest.php @@ -610,7 +610,7 @@ private function createItem($enclosureType = null) $this->item_mock->expects($this->exactly(1)) ->method('getLink') ->will($this->returnValue($this->permalink)); - $this->item_mock->expects($this->exactly(2)) + $this->item_mock->expects($this->exactly(1)) ->method('getTitle') ->will($this->returnValue($this->title)); $this->item_mock->expects($this->exactly(1))