Skip to content


Subversion checkout URL

You can clone with
Download ZIP


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

merged 1 commit into from

2 participants



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)."



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.

@CloCkWeRX CloCkWeRX merged commit ca9e357 into pear:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 29, 2011
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  XML/Feed/Parser/RSS2.php
3  XML/Feed/Parser/RSS2.php
@@ -321,7 +321,8 @@ function getCloud()
function getLink($offset, $attribute = 'href', $params = array())
- $links = $this->model->getElementsByTagName('link');
+ $xPath = new DOMXPath($this->model);
+ $links = $xPath->query('//link');
if ($links->length <= $offset) {
return false;
Something went wrong with that request. Please try again.