|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-08-25 07:27 UTC] sjoerd@php.net
[2009-08-26 12:29 UTC] admin at somesite dot de
[2010-02-01 13:45 UTC] svn@php.net
[2010-02-01 13:48 UTC] colder@php.net
[2010-02-05 00:37 UTC] svn@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 15:00:02 2025 UTC |
Description: ------------ When trying to make a class that implements IteratorAggregate and SPL's SeekableIterator the order of the interfaces in the list matters. One order (IA first SI second) works while the other (SI first IA second) produces a fatal error in Unknown. THESE TWO INTERFACES ARE SEPARATE AND DISTINCT - NO FUNCTIONS IN COMMON! Traversable -> Iterator -> SeekableIterator (seek,current,next,key,valid,rewind) Traversable -> IteratorAggregate (getIterator) I haven't been able to reproduce this with user-defined interfaces and I haven't gone looking to see if this happens with any other built-in interfaces. Something to do with that fact that they redefine how iteration on a class works? Reproduce code: --------------- #1 (works) abstract class Foo1 implements IteratorAggregate, SeekableIterator {} #2 (does not work) abstract class Foo2 implements SeekableIterator, IteratorAggregate {} Expected result: ---------------- #1 and #2 should both work or both not work. In this case, work, since neither have any functions in common to redefine. Actual result: -------------- #1 - okay #2 - "Fatal error: Class Foo2 could not implement interface IteratorAggregate in Unknown on line 0"