1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
This commit is contained in:
Nikita Popov
2017-12-22 18:00:17 +01:00
parent 0246373788
commit ccb113c3e5
3 changed files with 32 additions and 1 deletions

6
NEWS
View File

@@ -15,7 +15,11 @@ PHP NEWS
- SOAP:
. Fixed bug #70469 (SoapClient generates E_ERROR even if exceptions=1 is
used). (Anton Artamonov)
used). (Anton Artamonov)
- SPL:
. Fixed bug #75717 (RecursiveArrayIterator does not traverse arrays by
reference). (Nikita)
04 Jan 2018, PHP 7.1.13

View File

@@ -1642,6 +1642,7 @@ SPL_METHOD(Array, hasChildren)
RETURN_FALSE;
}
ZVAL_DEREF(entry);
RETURN_BOOL(Z_TYPE_P(entry) == IS_ARRAY || (Z_TYPE_P(entry) == IS_OBJECT && (intern->ar_flags & SPL_ARRAY_CHILD_ARRAYS_ONLY) == 0));
}
/* }}} */

View File

@@ -0,0 +1,26 @@
--TEST--
Bug #75717: RecursiveArrayIterator does not traverse arrays by reference
--FILE--
<?php
function flatten(array $nestedArraysAndStrings){
$flat=[];
$iter = new RecursiveIteratorIterator(
new RecursiveArrayIterator($nestedArraysAndStrings));
foreach($iter as $leaf){ $flat[] = $leaf; }
return join(NULL, $flat);
}
$noRefs = [[[['some']]],[' nested '],"items"];
$withRefs = []+$noRefs;
$wat = $noRefs[0];
$withRefs[0] = &$wat;
echo flatten($noRefs), "\n";
echo flatten($withRefs), "\n";
?>
--EXPECT--
some nested items
some nested items