mirror of
https://github.com/friendica/friendica
synced 2024-11-18 22:23:42 +00:00
Merge pull request #10822 from MrPetovan/bug/fatal-errors
Trim XML before emptiness check in Protocol\Feed::import
This commit is contained in:
commit
2a8d8d402c
1 changed files with 3 additions and 1 deletions
|
@ -69,6 +69,8 @@ class Feed
|
||||||
Logger::info("Import Atom/RSS feed '" . $contact["name"] . "' (Contact " . $contact["id"] . ") for user " . $importer["uid"]);
|
Logger::info("Import Atom/RSS feed '" . $contact["name"] . "' (Contact " . $contact["id"] . ") for user " . $importer["uid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$xml = trim($xml);
|
||||||
|
|
||||||
if (empty($xml)) {
|
if (empty($xml)) {
|
||||||
Logger::info('XML is empty.');
|
Logger::info('XML is empty.');
|
||||||
return [];
|
return [];
|
||||||
|
@ -83,7 +85,7 @@ class Feed
|
||||||
}
|
}
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
@$doc->loadXML(trim($xml));
|
@$doc->loadXML($xml);
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
$xpath->registerNamespace('atom', ActivityNamespace::ATOM1);
|
$xpath->registerNamespace('atom', ActivityNamespace::ATOM1);
|
||||||
$xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");
|
$xpath->registerNamespace('dc', "http://purl.org/dc/elements/1.1/");
|
||||||
|
|
Loading…
Reference in a new issue