Skip to content

Commit 12b252e

Browse files
committed
Merge branch 'PHP-5.4'
* PHP-5.4: Fixed bug RecursiveArrayIterator does not implement Countable
2 parents e31cebc + cce4764 commit 12b252e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

‎ext/spl/spl_array.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,7 @@ PHP_MINIT_FUNCTION(spl_array)
19431943
REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate);
19441944
REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess);
19451945
REGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable);
1946+
REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable);
19461947
memcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
19471948

19481949
spl_handler_ArrayObject.clone_obj = spl_array_object_clone;
@@ -1967,16 +1968,14 @@ PHP_MINIT_FUNCTION(spl_array)
19671968
REGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess);
19681969
REGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator);
19691970
REGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable);
1971+
REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable);
19701972
memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers));
19711973
spl_ce_ArrayIterator->get_iterator = spl_array_get_iterator;
19721974

19731975
REGISTER_SPL_SUB_CLASS_EX(RecursiveArrayIterator, ArrayIterator, spl_array_object_new, spl_funcs_RecursiveArrayIterator);
19741976
REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator);
19751977
spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator;
19761978

1977-
REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable);
1978-
REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable);
1979-
19801979
REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "STD_PROP_LIST", SPL_ARRAY_STD_PROP_LIST);
19811980
REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, "ARRAY_AS_PROPS", SPL_ARRAY_ARRAY_AS_PROPS);
19821981

‎ext/spl/tests/bug62262.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Bug #62262: RecursiveArrayIterator does not implement Countable
3+
--FILE--
4+
<?php
5+
6+
var_dump(new RecursiveArrayIterator(array()) instanceof Countable);
7+
8+
?>
9+
--EXPECT--
10+
bool(true)

0 commit comments

Comments
 (0)