]> git.mxchange.org Git - friendica.git/commitdiff
Trim XML before emptiness check in Protocol\Feed::import
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 3 Oct 2021 23:32:20 +0000 (19:32 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 3 Oct 2021 23:32:20 +0000 (19:32 -0400)
- Address https://github.com/friendica/friendica/issues/10791

src/Protocol/Feed.php

index d793ac817f28526cd8cdc055c7f118882dfc5b12..907479776c37f6745e1d57ed0ae188328cd53d4a 100644 (file)
@@ -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/");