From a4706e9521be2719d96ceeb7800c06371316a684 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 3 Oct 2021 19:32:20 -0400 Subject: [PATCH] Trim XML before emptiness check in Protocol\Feed::import - Address https://github.com/friendica/friendica/issues/10791 --- src/Protocol/Feed.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index d793ac817f..907479776c 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -69,6 +69,8 @@ class Feed Logger::info("Import Atom/RSS feed '" . $contact["name"] . "' (Contact " . $contact["id"] . ") for user " . $importer["uid"]); } + $xml = trim($xml); + if (empty($xml)) { Logger::info('XML is empty.'); return []; @@ -83,7 +85,7 @@ class Feed } $doc = new DOMDocument(); - @$doc->loadXML(trim($xml)); + @$doc->loadXML($xml); $xpath = new DOMXPath($doc); $xpath->registerNamespace('atom', ActivityNamespace::ATOM1); $xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");