Zend Framework

Zend_Session_Namespace::getIterator() returns ArrayObject instead of Iterator

Details

  • Type: Bug Bug
  • Status: Postponed Postponed
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Zend_Session
  • Labels:
    None

Description

IteratorAggregate::getItterator should return instanceof Iterator: http://www.php.net/~helly/php/ext/spl/interfaceIteratorAggregate.html

Namespace returns ArrayObject which does not implement Iterator: http://www.php.net/~helly/php/ext/spl/classArrayObject.html

This is moot when using the namespace in a foreach since the foreach calls getItterator on the namespace, and again on the ArrayObject (Im think ).

Test:

Zend_Session::start();
$ns = new Zend_Session_Namespace('test-namespace');
assert($ns->getIterator() instanceof Iterator);

Possible Fix:

Zend_Session_Namespace 182:         return new ArrayIterator(parent::_namespaceGetAll($this->_namespace));

Version:
I don't know what version the trunk refers to, here is the @version annotation
$Id: Namespace.php 11003 2008-08-24 14:43:15Z matthew $

Activity

Hide
julien PAULI added a comment -

You are rigth, it's called twice.

However, the patch could break backward compatibility as some users might use specific ArrayObject methods that would raise a fatal error.

Show
julien PAULI added a comment - You are rigth, it's called twice. However, the patch could break backward compatibility as some users might use specific ArrayObject methods that would raise a fatal error.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: