xref: /PHP-8.3/ext/standard/tests/array/bug72622.phpt (revision f8d79582)
1--TEST--
2Bug #72622 (array_walk + array_replace_recursive create references from nothing)
3--FILE--
4<?php
5
6function walk (array $arr) {
7    array_walk($arr, function (&$val, $name) {
8
9    });
10
11    return $arr;
12}
13
14$arr3 = ['foo' => 'foo'];
15$arr4 = walk(['foo' => 'bar']);
16$arr5 = array_replace_recursive($arr3, $arr4);
17$arr5['foo'] = 'baz';
18
19var_dump($arr3, $arr4, $arr5);
20
21?>
22--EXPECT--
23array(1) {
24  ["foo"]=>
25  string(3) "foo"
26}
27array(1) {
28  ["foo"]=>
29  string(3) "bar"
30}
31array(1) {
32  ["foo"]=>
33  string(3) "baz"
34}
35