1--TEST--
2Test compact() function : usage variations  - arrays containing references.
3--FILE--
4<?php
5/*
6* compact variations - arrays with references
7*/
8echo "*** Testing compact() : usage variations  - arrays containing references ***\n";
9$a = 1;
10$b = 2;
11$c = 3;
12$string = "c";
13$arr1 = array("a", &$arr1);
14$arr2 = array("a", array(array(array("b"))));
15$arr2[1][0][0][] = &$arr2;
16$arr2[1][0][0][] = &$arr2[1];
17$arr3 = array(&$string);
18
19try {
20    var_dump(compact($arr1));
21} catch (Error $e) {
22    echo $e->getMessage() . "\n";
23}
24
25try {
26    var_dump(compact($arr2));
27} catch (Error $e) {
28    echo $e->getMessage() . "\n";
29}
30
31var_dump(compact($arr3));
32
33?>
34--EXPECT--
35*** Testing compact() : usage variations  - arrays containing references ***
36Recursion detected
37Recursion detected
38array(1) {
39  ["c"]=>
40  int(3)
41}
42