From 32688d34b633ab7a072198a81f0bca2988407409 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 7 May 2023 00:00:55 -0400 Subject: [PATCH] Ensure $atomns is always set in Protocol\Feed - Address https://github.com/friendica/friendica/issues/13025#issuecomment-1537162173 --- src/Protocol/Feed.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 8c6b4c28d1..a43124c691 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -103,7 +103,7 @@ class Feed $xpath->registerNamespace('poco', ActivityNamespace::POCO); $author = []; - $atomns = ''; + $atomns = 'atom'; $entries = null; $protocol = Conversation::PARCEL_UNKNOWN; @@ -128,13 +128,12 @@ class Feed // Is it Atom? if ($xpath->query('/atom:feed')->length > 0) { $protocol = Conversation::PARCEL_ATOM; - $atomns = 'atom'; } elseif ($xpath->query('/atom03:feed')->length > 0) { $protocol = Conversation::PARCEL_ATOM03; $atomns = 'atom03'; } - if (!empty($atomns)) { + if (in_array($protocol, [Conversation::PARCEL_ATOM, Conversation::PARCEL_ATOM03])) { $alternate = XML::getFirstAttributes($xpath, $atomns . ":link[@rel='alternate']"); if (is_object($alternate)) { foreach ($alternate as $attribute) { @@ -335,7 +334,7 @@ class Feed case 'text': $body = $attribute->nodeValue; break; - + case 'htmlUrl': $plink = $attribute->nodeValue; break; @@ -343,7 +342,7 @@ class Feed case 'xmlUrl': $uri = $attribute->nodeValue; break; - + case 'type': $isrss = $attribute->nodeValue == 'rss'; break; @@ -506,7 +505,7 @@ class Feed $attachment['type'] = Post\Media::DOCUMENT; } $attachments[] = $attachment; - } + } } }