- Fixed spl_autoload_unregister/spl_autoad_functions wrt. Closures and
Functors. (Christian Seiler)
+- Fixed bug #48854 (array_merge_recursive modifies arrays after first one).
+ (Felipe)
- Fixed bug #48788 (RecursiveDirectoryIterator doesn't descend into symlinked
directories). (Ilia)
- Fixed bug #48771 (rename() between volumes fails and reports no error on
array_init_size(return_value, init_size);
for (i = 0; i < argc; i++) {
+ SEPARATE_ZVAL(args[i]);
if (!replace) {
php_array_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(args[i]), recursive TSRMLS_CC);
} else if (recursive && i > 0) { /* First array will be copied directly instead */
--- /dev/null
+--TEST--
+Bug #48854 (array_merge_recursive modifies arrays after first one)
+--FILE--
+<?php
+
+$array1 = array(
+ 'friends' => 5,
+ 'children' => array(
+ 'dogs' => 0,
+ ),
+);
+
+$array2 = array(
+ 'friends' => 10,
+ 'children' => array(
+ 'cats' => 5,
+ ),
+);
+
+$merged = array_merge_recursive($array1, $array2);
+
+var_dump($array1, $array2);
+
+?>
+--EXPECTF--
+array(2) {
+ [%u|b%"friends"]=>
+ int(5)
+ [%u|b%"children"]=>
+ array(1) {
+ [%u|b%"dogs"]=>
+ int(0)
+ }
+}
+array(2) {
+ [%u|b%"friends"]=>
+ int(10)
+ [%u|b%"children"]=>
+ array(1) {
+ [%u|b%"cats"]=>
+ int(5)
+ }
+}