Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS 1.0 miss some unique identifier #141

Closed
casta opened this issue Jun 7, 2011 · 0 comments
Closed

RSS 1.0 miss some unique identifier #141

casta opened this issue Jun 7, 2011 · 0 comments

Comments

@casta
Copy link

casta commented Jun 7, 2011

According to the RSS 1.0 spec, RSS 1.0 feeds should use the "rdf:about" attribute of the to store the item identifier (see http://www.mnot.net/rss/tutorial/#RSS10).
A good feed example is http://kernel.org/kdist/rss.xml

When parsing this rss 1.0 feeds with simplepie, the Item->get_id() falls back to the link as ID, which is quite bad this it's not unique !
So here is a very small patch (on top of git master) that fixes this and try to use the rdf:about attribute in Item->get_id() before falling back to link. This fixes the feed handling :

diff --git a/SimplePie/Item.php b/SimplePie/Item.php
index 86e6ef4..35d6b6c 100644
--- a/SimplePie/Item.php
+++ b/SimplePie/Item.php
@@ -122,6 +122,10 @@ class SimplePie_Item
                        {
                                return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
                        }
+                       elseif ($return = $this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'])
+                       {
+                               return $this->sanitize($return, SIMPLEPIE_CONSTRUCT_TEXT);
+                       }
                        elseif (($return = $this->get_permalink()) !== null)
                        {
                                return $return;
@rmccue rmccue closed this as completed in 089509c Sep 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants