Trim XML before emptiness check in Protocol\Feed::import

- Address https://github.com/friendica/friendica/issues/10791
This commit is contained in:
Hypolite Petovan 2021-10-03 19:32:20 -04:00
parent fe68df8e6a
commit a4706e9521

View 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/");