Commit d9981b52 authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Stop warnings from invalid image element in rss feed (bug #849574)"

parents b73b8762 d804d79e
......@@ -197,6 +197,12 @@ class XML_Feed_Parser_RSS2 extends XML_Feed_Parser_Type
$images = $this->xpath->query("//image");
if ($images->length > 0) {
$image = $images->item(0);
$title = $image->getElementsByTagName('title');
$link = $image->getElementsByTagName('link');
$url = $image->getElementsByTagName('url');
if (!$title->length || !$link->length || !$url->length) {
return false;
}
$desc = $image->getElementsByTagName('description');
$description = $desc->length ? $desc->item(0)->nodeValue : false;
$heigh = $image->getElementsByTagName('height');
......@@ -204,9 +210,9 @@ class XML_Feed_Parser_RSS2 extends XML_Feed_Parser_Type
$widt = $image->getElementsByTagName('width');
$width = $widt->length ? $widt->item(0)->nodeValue : false;
return array(
'title' => $image->getElementsByTagName('title')->item(0)->nodeValue,
'link' => $image->getElementsByTagName('link')->item(0)->nodeValue,
'url' => $image->getElementsByTagName('url')->item(0)->nodeValue,
'title' => $title->item(0)->nodeValue,
'link' => $link->item(0)->nodeValue,
'url' => $url->item(0)->nodeValue,
'description' => $description,
'height' => $height,
'width' => $width);
......
......@@ -10,4 +10,5 @@ Changes:
* Patch to make the parser respect its own $suppressWarnings flag (commit 86876df5beae591aef169cc52690b3c18a87b195)
* Patch to make the parser pick the correct <link> from the feed (commit 64fd0805d937b338c82d9ef40c5d7e1e3411ca42)
* Avoid warnings when image element has no title, link, or url attribute
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment