fix previous to not crash if document first child is not a DOMElement or whatever

This commit is contained in:
Andrew Dolgov 2018-08-12 19:27:04 +03:00
parent 7418323f53
commit eb43d9f4a8
1 changed files with 5 additions and 1 deletions

View File

@ -205,7 +205,11 @@ class FeedItem_Atom extends FeedItem_Common {
return $lang;
} else {
// Fall back to the language declared on the feed, if any.
return $this->doc->firstChild->getAttributeNS(self::NS_XML, "lang");
foreach ($this->doc->childNodes as $child) {
if (method_exists($child, "getAttributeNS")) {
return $child->getAttributeNS(self::NS_XML, "lang");
}
}
}
}
}