ZF-4576: Zend_Session_Namespace::getIterator() returns ArrayObject instead of Iterator

Description

IteratorAggregate::getItterator should return instanceof Iterator: http://php.net/~helly/php/…

Namespace returns ArrayObject which does not implement Iterator: http://php.net/~helly/php/…

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 $

Comments

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.