xref: /PHP-7.1/ext/standard/tests/array/bug43495.phpt (revision 7af945e2)
1--TEST--
2Bug #43495 (array_merge_recursive() crashes with recursive arrays)
3--FILE--
4<?php
5$a=array("key1"=>array("key2"=>array()));
6$a["key1"]["key2"]["key3"]=&$a;
7
8$b=array("key1"=>array("key2"=>array()));
9$b["key1"]["key2"]["key3"]=&$b;
10
11array_merge_recursive($a,$b);
12
13/* Break recursion */
14$a["key1"]["key2"]["key3"] = null;
15$b["key1"]["key2"]["key3"] = null;
16
17echo "Done.\n";
18?>
19--EXPECTF--
20Warning: array_merge_recursive(): recursion detected in %sbug43495.php on line %d
21Done.
22