From db53d2655b1771bd32fe2eb2c042b6b89f981c74 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 14 Sep 2023 20:24:22 +0200 Subject: Allow string in XPath tags (#5653) fix https://github.com/FreshRSS/FreshRSS/issues/5651 --- app/Models/Feed.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 80d4e4580..e295804ae 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -723,8 +723,10 @@ class FreshRSS_Feed extends Minz_Model { } $item['thumbnail'] = $xPathItemThumbnail == '' ? '' : @$xpath->evaluate('normalize-space(' . $xPathItemThumbnail . ')', $node); if ($xPathItemCategories != '') { - $itemCategories = @$xpath->query($xPathItemCategories, $node); - if ($itemCategories !== false) { + $itemCategories = @$xpath->evaluate($xPathItemCategories, $node); + if (is_string($itemCategories) && $itemCategories !== '') { + $item['tags'] = [$itemCategories]; + } elseif ($itemCategories instanceof DOMNodeList && $itemCategories->length > 0) { $item['tags'] = []; /** @var DOMNode $itemCategory */ foreach ($itemCategories as $itemCategory) { -- cgit v1.2.3