From eb43d9f4a8a8609b7f30ef4e2add425b9c91fe00 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 12 Aug 2018 19:27:04 +0300 Subject: [PATCH] fix previous to not crash if document first child is not a DOMElement or whatever --- classes/feeditem/atom.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index ee5591757..8c3e0f8a7 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"); + } + } } } }