|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-16 08:22 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 15:00:01 2025 UTC |
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.