|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-11-13 03:24 UTC] helly@php.net
[2003-11-13 11:30 UTC] adam at trachtenberg dot com
[2003-11-13 13:57 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 12:00:01 2025 UTC |
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