xref: /PHP-8.2/ext/standard/tests/array/bug79930.phpt (revision da786a22)
1--TEST--
2Bug #79930: array_merge_recursive() crashes when called with array with single reference
3--FILE--
4<?php
5
6$a = 'a';
7$array = [
8    'value' => $a . 'b',
9];
10
11// Create rc=1 reference.
12array_walk($array, function () {});
13
14$m = array_merge_recursive(['value' => 'a'], $array);
15
16var_dump($a, $array, $m);
17
18?>
19--EXPECT--
20string(1) "a"
21array(1) {
22  ["value"]=>
23  string(2) "ab"
24}
25array(1) {
26  ["value"]=>
27  array(2) {
28    [0]=>
29    string(1) "a"
30    [1]=>
31    string(2) "ab"
32  }
33}
34