|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62262 RecursiveArrayIterator does not implement Countable
Submitted: 2012-06-08 09:05 UTC Modified: 2012-06-19 16:47 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: gen dot work at gmail dot com Assigned: nikic (profile)
Status: Closed Package: SPL related
PHP Version: 5.3.13 OS: Windows XP, Ubuntu 10.04
Private report: No CVE-ID: None
 [2012-06-08 09:05 UTC] gen dot work at gmail dot com
The RecursiveArrayIterator class does not implement Countable interface, although it extends ArrayIterator.

Test script:
$it  = new \ArrayIterator(array(1, 2, 3));
$rit = new \RecursiveArrayIterator($it);

var_dump($it instanceof \Countable);
var_dump($rit instanceof \Countable);

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-08 23:34 UTC]
-Status: Open +Status: Verified
 [2012-06-08 23:34 UTC]
Reproduced on 5.4.1. The problem is probably that ArrayIterator implements Countable only *after* RecursiveArrayIterator already inherited from it (see Fixing should be as simple as moving that macro a few lines up :)
 [2012-06-19 16:47 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

Fixed in
 [2012-06-19 16:47 UTC]
-Status: Verified +Status: Closed -Assigned To: +Assigned To: nikic
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 29 15:01:32 2024 UTC