1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/standard/tests/array/array_replace_merge_recursive_ref.phpt
Adam Saponara 55d17662cb Fix bug #71241: array_replace_recursive mutates ref params
`array_replace_recursive` can sometimes mutate its params if
references are nested within. This differs from the PHP 5 behavior.
2016-10-20 13:22:04 +02:00

32 lines
536 B
PHP

--TEST--
Test array_(replace|merge)_recursive with references
--FILE--
<?php
$one = [1];
$two = [42];
$arr1 = ['k' => &$one];
$arr2 = ['k' => &$two];
var_dump(current($one), current($two));
array_replace_recursive($arr1, $arr2);
var_dump(current($one), current($two));
$one = [1];
$two = [42];
$arr1 = ['k' => &$one];
$arr2 = ['k' => &$two];
var_dump(current($one), current($two));
array_merge_recursive($arr1, $arr2);
var_dump(current($one), current($two));
?>
--EXPECT--
int(1)
int(42)
int(1)
int(42)
int(1)
int(42)
int(1)
int(42)