ID:               37457
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jaco at welnet dot nl
-Status:           Open
+Status:           Closed
 Bug Type:         SPL related
 Operating System: CentOS 4.3
 PHP Version:      5.1.4
 New Comment:

This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.


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

[2006-05-16 08:00:55] jaco at welnet dot nl

Description:
------------
Filtering an object which implements Iterator produces the error below,
but an ArrayIterator works fine.





Reproduce code:
---------------
<?
class Collection implements Iterator {
        
        protected $array, $valid = false;
        
        public function __construct(array $a) { $this->array = $a; }
        
        public function current() { return current($this->array); }
        public function key() { return key($this->array); }
        public function next() { $this->valid = (false !==
next($this->array)); }
        public function valid() { return $this->valid; }
        public function rewind() { $this->valid = (false !==
reset($this->array)); }
}

class TestFilter extends FilterIterator {
    public function accept() { throw new Exception("Me crash!"); }
}

$test = new TestFilter( new Collection(array(0)) );

foreach ($test as $item) {
        echo $item;
}
?>

Expected result:
----------------
Uncaught exception message.

Actual result:
--------------
>From CLI:
Fatal error: Couldn't execute method Collection::next in Unknown on
line 0.

As a httpd module it only prints garbage characters on screen.


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


-- 
Edit this bug report at http://bugs.php.net/?id=37457&edit=1

Reply via email to