ID: 26229 Updated by: [EMAIL PROTECTED] Reported By: adam at trachtenberg dot com -Status: Open +Status: Closed Bug Type: Zend Engine 2 problem -Operating System: Mac OS X 10.3 +Operating System: * -PHP Version: 5CVS-2003-11-12 (dev) +PHP Version: 5.0.0b2 -Assigned To: +Assigned To: helly New Comment:
It is not possible to allow it to return arrays. If you really need to mix objects with arrays you can use spl wich provides an array iterator. Unfortunatley that part of spl doesn't work atm (i think). But i will fix it during the next week. Previous Comments: ------------------------------------------------------------------------ [2003-11-12 18:31:30] adam at trachtenberg dot com Description: ------------ Having getIterator() return an array instead of an object that implements Iterator causes a bus error / seg fault. The ZE2 Changes document says "method getIterator() which must return an array or an object that either implements the interface Iterator...." Trying to return non-array values (which should not be allowed), like 'foo', also cause crashes instead of returning an error. Reproduce code: --------------- class array_iterator implements IteratorAggregate { public function getIterator() { return array('foo', 'bar'); } } $obj = new array_iterator; foreach ($obj as $property => $value) { print "$value\n"; } Expected result: ---------------- foo bar Actual result: -------------- Bus Error ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26229&edit=1