xref: /PHP-5.6/ext/standard/tests/array/bug42177.phpt (revision eea093b4)
1--TEST--
2Bug #42177 (Warning "array_merge_recursive(): recursion detected" comes again...)
3--FILE--
4<?php
5
6$a1 = array( 'key1' => 1, 'key3' => 2 );
7$a2 = array();
8$a1 = array_merge_recursive( $a1, $a2 );
9$a1 = array_merge_recursive( $a1, $a2 );
10unset( $a1, $a2 );
11
12$a1 = array();
13$a2 = array( 'key1' => 1, 'key3' => 2 );
14$a1 = array_merge_recursive( $a1, $a2 );
15$a1 = array_merge_recursive( $a1, $a2 );
16unset( $a1, $a2 );
17
18$a1 = array();
19$a2 = array( 'key1' => &$a1 );
20$a1 = array_merge_recursive( $a1, $a2 );
21$a1 = array_merge_recursive( $a1, $a2 );
22unset( $a1, $a2 );
23
24$x = 'foo';
25$y =& $x;
26$a1 = array($x, $y, $x, $y);
27$a2 = array( 'key1' => $a1, $x, $y );
28$a1 = array_merge_recursive( $a1, $a2 );
29$a1 = array_merge_recursive( $a1, $a2 );
30unset( $a1, $a2 );
31
32?>
33--EXPECTF--
34Warning: array_merge_recursive(): recursion detected in %s on line 18
35