xref: /PHP-5.3/ext/json/tests/003.phpt (revision 250393f9)
1--TEST--
2json_encode() & endless loop - 1
3--SKIPIF--
4<?php if (!extension_loaded("json")) print "skip"; ?>
5--FILE--
6<?php
7
8$a = array();
9$a[] = &$a;
10
11var_dump($a);
12var_dump(json_encode($a));
13
14/* Break circular data structure to prevent memory leaks */
15unset($a[0]);
16
17echo "Done\n";
18?>
19--EXPECTF--
20array(1) {
21  [0]=>
22  &array(1) {
23    [0]=>
24    *RECURSION*
25  }
26}
27
28Warning: json_encode(): recursion detected in %s on line %d
29string(8) "[[null]]"
30Done
31