Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

atom:link causes getLink to fail for RSS2.php #2

merged 1 commit into from over 2 years ago

2 participants

Ben Daniel O'Connor


I submitted a bug to a long time ago for this bug. Recently @meldra messaged me asking if I could bring it into github, so here it is.

Original bug description:

"The RSS 2.0 spec specifies that you should use however some sites such as recommend adding also.

getElementsByTagName will return both these links when searching for 'link'. If the atom:link is first then $link->nodeValue is an empty string and this eventually calls combineBases passing $element->baseURI (which in my case ends up being the folder of the file)

An example of the kind of feed that can trigger this is

I have attached a diff of my change to fix this issue using xpath to only match and not atom:link (or any other namespaced link attributes)."


Daniel O'Connor

It's rarely done, but would people ever put rss2 elements in a rss2 namespace? ie: rss:link?

Possibly - if the standard supports that then the getLink function should too. I'm afraid I don't have the time to dig back into this bug, it's been a while and I don't work on the project anymore. Hopefully now Pear is on github (yay!) hopefully others will weigh in.

Daniel O'Connor CloCkWeRX merged commit ca9e357 into from
Daniel O'Connor CloCkWeRX closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 30, 2011
Committing my patch from ae0cf90
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  XML/Feed/Parser/RSS2.php
3  XML/Feed/Parser/RSS2.php
@@ -321,7 +321,8 @@ function getCloud()
321 321
322 322
     function getLink($offset, $attribute = 'href', $params = array())
323 323
-        $links = $this->model->getElementsByTagName('link');
+        $xPath = new DOMXPath($this->model);
+        $links = $xPath->query('//link');
325 326
326 327
         if ($links->length <= $offset) {
327 328
             return false;

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.