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: *
 PHP Version:      5.0.0b2
 Assigned To:      helly
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


Previous Comments:
------------------------------------------------------------------------

[2003-11-13 11:30:42] adam at trachtenberg dot com

It still shouldn't segfault when you return an array or 
scalar.

------------------------------------------------------------------------

[2003-11-13 03:24:15] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[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

Reply via email to