From: Andrew Dolgov Date: Sun, 12 Aug 2018 16:27:04 +0000 (+0300) Subject: fix previous to not crash if document first child is not a DOMElement or whatever X-Git-Tag: 18.8~3 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=eb43d9f4a8a8609b7f30ef4e2add425b9c91fe00;p=tt-rss.git fix previous to not crash if document first child is not a DOMElement or whatever --- diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index ee559175..8c3e0f8a 100644 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -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"); + } + } } } }