From:             su1d at phpclub dot net
Operating system: Win32
PHP version:      5CVS-2004-07-26 (dev)
PHP Bug Type:     Reproducible crash
Bug description:  crash by invalid Iterator returned from ArrayObject::getIterator()

Description:
------------
Please, check the code.

P.S. When $this is returned instead of "null" you do get the correct error
message, but PHP still crashes.

P.P.S. What do we have Traversable interface for?


Reproduce code:
---------------
<?php

class ArrayObj extends ArrayObject {
        function getIterator() { return $this; }
}

foreach(new ArrayObj(array(123)) as $idx => $line) {
        echo "$idx: $line\n";
}

?>

Expected result:
----------------
Warning: Objects returned by ArrayObj::getIterator() must be traversable
or implement interface Iterator in ... on line 7

Actual result:
--------------
*SILENT CRASH*


-- 
Edit bug report at http://bugs.php.net/?id=29382&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29382&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29382&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29382&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29382&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29382&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29382&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29382&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29382&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29382&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29382&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29382&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29382&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29382&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29382&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29382&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29382&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29382&r=float

Reply via email to