|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [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: Thu Oct 28 07:03:34 2021 UTC