ZF-26: Zend_Feed doesn't read entries not in the channel element (TRAC#7)

Issue Type: Bug Created: 2006-06-19T22:48:53.000+0000 Last Updated: 2009-02-02T18:03:09.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Zend Framework (zend_framework) Assignee: Matthew Turland (elazar) Tags: - Zend_Feed

Related issues: - ZF-2252



After running into this problem in my own feed class, I tried the Zend version out to try to figure out the problem. Turns out it's from entry items NOT being in the channel element. See this feed for an example:

Here's my quick and dirty solution:

<pre class="highlight">
protected function _buildEntryCache()
  $this->_entries = array();
  foreach ($this->_element->childNodes as $child) {
    if ($child->localName == $this->_entryElementName) {
      $this->_entries[] = $child;

    // Added this.
  if (count($this->_entries) == 0) {
    foreach ($this->_element->parentNode->childNodes as $child) {
      if ($child->localName == $this->_entryElementName) {
        $this->_entries[] = $child;


Posted by Bill Karwin (bkarwin) on 2006-11-13T15:16:40.000+0000

Changing fix version to 0.6.0.

Posted by Simone Carletti (weppos) on 2007-12-01T12:42:00.000+0000

I forgot to say that my previous comment has been inspired by…

Posted by Simone Carletti (weppos) on 2007-12-01T12:43:11.000+0000

Forgive me for previous comment. It was created for ZF-405, I posted it here by mistake.

Posted by Matthew Turland (elazar) on 2008-01-31T19:50:30.000+0000

The following example appears to work as expected as of SVN revision 7745:

require_once 'Zend/Feed.php';

$feed = Zend_Feed::import('');

foreach ($feed as $item) { echo 'title: ', $item->title(), "\n"; echo 'link: ', $item->link(), "\n\n"; }

Posted by Simone Carletti (weppos) on 2008-02-01T02:30:08.000+0000

The issue still exists. The reason why you wasn't able to reproduce it is just because the feed you tested is no longer an RSS feed but it's now served as Atom feed and Zend_Feed correctly supports Atom feeds.

Have a look at the following example:

<pre class="highlight">
require_once 'Zend/Feed.php';

$feed = Zend_Feed::import('<a href=""></a>');

foreach ($feed as $item) { echo 'title: ', $item->title(), "\n"; echo 'link: ', $item->link(), "\n\n"; }

Posted by Matthew Turland (elazar) on 2008-02-03T09:24:35.000+0000

Please see the attachment patch.diff for ZF-405. This appears to correct this issue.

For the particular feed cited below, something I noticed that wasn't the case for ZF-405 is that there are two title attributes per item, title and dc:title, and the returned Zend_Feed_Rss object reflects this. I'm not sure if this should be considered a "feature" or a "bug" being that, in most cases, the two elements have the same value anyway.

Posted by Wil Sinclair (wil) on 2008-12-19T15:06:30.000+0000

Matthew, what is the status of this issue? Do you need someone to apply your patch?

Posted by Matthew Turland (elazar) on 2008-12-19T17:51:07.000+0000

Wil, I've updated ZF-405 with a new version of the patch. It does not modify the suggested change to Zend_Feed_Rss::__wakeup (which still works), but updates the unit tests in a way that I think will be more agreeable to other developers. But yes, I don't believe I have the access needed to commit the patch myself, so it will need to be committed by someone else.

Posted by Benjamin Eberlei (beberlei) on 2009-01-08T04:39:21.000+0000

Applied patch from Matthew in ZF-405, which solves this issues.

Posted by old of Satoru Yoshida ( on 2009-02-02T18:03:09.000+0000

Sorry, not in 1.7.4. I think it may be released in next minor.

Have you found an issue?

See the Overview section for more details.


© 2006-2020 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.