|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63507 IteratorIterator inheritance problems
Submitted: 2012-11-13 22:12 UTC Modified: 2012-11-13 22:24 UTC
From: Assigned: levim (profile)
Status: Closed Package: SPL related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2012-11-13 22:12 UTC]
IteratorIterator has a method `seek` that matches the signature for implementing 
SeekableIterator, but it doesn't implement the interface.

Also, subclasses of IteratorIterator do not inherit the seek method. This breaks 
the rules for inheritance.

I'm not sure how to propose fixing it at this point.  This should have been caught 
before being released. Like much of the SPL, this was not properly thought out and 

Test script:
$iterator = new IteratorIterator(
    new EmptyIterator()

var_dump($iterator instanceof SeekableIterator);
var_dump(method_exists($iterator, 'seek');

$iterator = new NoRewindIterator(
    new EmptyIterator()
var_dump(method_exists($iterator, 'seek');

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-13 22:24 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

I seem to have tested the wrong things, somehow.  Silly mistake.
 [2012-11-13 22:24 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: levim
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Oct 22 19:07:12 2021 UTC