mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Fixed bug #75717
This commit is contained in:
6
NEWS
6
NEWS
@@ -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
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
26
ext/spl/tests/bug75717.phpt
Normal file
26
ext/spl/tests/bug75717.phpt
Normal 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
|
||||
Reference in New Issue
Block a user