feedparser: check if initial xpath query for root element returns anything

This commit is contained in:
Andrew Dolgov 2013-06-19 19:40:36 +04:00
parent 84acb0b711
commit a9000b0344
1 changed files with 19 additions and 15 deletions

View File

@ -51,7 +51,10 @@ class FeedParser {
$this->xpath = $xpath;
$root = $xpath->query("(//atom03:feed|//atom:feed|//channel|//rdf:rdf|//rdf:RDF)")->item(0);
$root = $xpath->query("(//atom03:feed|//atom:feed|//channel|//rdf:rdf|//rdf:RDF)");
if ($root) {
$root = $root->item(0);
if ($root) {
switch (mb_strtolower($root->tagName)) {
@ -70,6 +73,7 @@ class FeedParser {
}
return;
}
}
switch ($this->type) {
case $this::FEED_ATOM: