ZF-10954: Identifier returned by Zend_Feed_Reader_Entry_Rss::getID() is not unique

Description

According to documentation, Zend_Feed_Reader_Entry_Rss::getID() "Returns a unique ID for the current entry.": http://framework.zend.com/manual/en/…

In fact, the identifier is not necessarily unique. The method tries to obtain a uid from several of the item's fields:

/**
 * Get the entry ID
 *
 * @return string
 */
public function getId()
{
    if (array_key_exists('id', $this->_data)) {
        return $this->_data['id'];
    }

    $id = null;

    if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10
        && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090
    ) {
        $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)');
    }

    if (!$id) {
        $id = $this->getExtension('DublinCore')->getId();
    }

    if (empty($id)) {
        $id = $this->getExtension('Atom')->getId();
    }

    if (!$id) {
        if ($this->getPermalink()) {
            $id = $this->getPermalink();
        } elseif ($this->getTitle()) {
            $id = $this->getTitle();
        } else {
            $id = null;
        }
    }

    $this->_data['id'] = $id;

    return $this->_data['id'];
}

For a RSS 2 feed without guid, getPermalink() (which uses the link element) is a fallback. As my test case feed shows, two items can have the same value for link. This causes 2 items to have the same return value for getId().

Comments

Here is the test case feed:

<?xml version="1.0"?> SourceForge.net: Project Summary: Tiki Wiki CMS Groupware (tikiwiki project)http://sourceforge.net/projects/tikiwiki/ A summary of key project details for the tikiwiki project on SourceForge.net.Copyright and acceptable use information for this RSS feed may be found at: http://p.sf.net/sourceforge/termsSun, 16 Jan 2011 04:48:42 GMTSourceForge.net RSS generatorDownloadable files: 902745 total downloads to dateMost recent daily statistics (16 Jan 2011): Download count: 167http://sourceforge.net/project/showfiles.php/… Sun, 16 Jan 2011 04:48:42 GMTDownloadable files: 900000 total downloads to dateMost recent daily statistics (14 Jan 2011): Download count: 150http://sourceforge.net/project/showfiles.php/… Sun, 16 Jan 2011 00:48:42 GMT