Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

Ben Daniel O'Connor
Ben

Hi,

I submitted a bug to https://pear.php.net/bugs/bug.php?id=16416 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 http://workbench.cadenhead.org/news/3284/adding-atomlink-your-rss-feed 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 http://blog.mudrak.name/feed/?tag=mahara

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

Thanks

Daniel O'Connor
Owner

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
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
View
@@ -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.