Edit report at https://bugs.php.net/bug.php?id=62262&edit=1

 ID:                 62262
 Updated by:         [email protected]
 Reported by:        gen dot work at gmail dot com
 Summary:            RecursiveArrayIterator does not implement Countable
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            SPL related
 Operating System:   Windows XP, Ubuntu 10.04
 PHP Version:        5.3.13
 Block user comment: N
 Private report:     N

 New Comment:

Reproduced on 5.4.1. The problem is probably that ArrayIterator implements 
Countable only *after* RecursiveArrayIterator already inherited from it (see 
http://lxr.php.net/xref/PHP_TRUNK/ext/spl/spl_array.c#1978). Fixing should be 
as simple as moving that macro a few lines up :)


Previous Comments:
------------------------------------------------------------------------
[2012-06-08 09:05:16] gen dot work at gmail dot com

Description:
------------
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:
----------------
bool(true)
bool(true)

Actual result:
--------------
bool(true)
bool(false)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62262&edit=1

Reply via email to