1
0
mirror of https://github.com/php/php-src.git synced 2026-04-05 23:23:03 +02:00
Files
archived-php-src/ext/json/tests/003.phpt
Nikita Popov b7903f9778 Revert JSON merges to 5.4
This reverts the following merge commits (-m 1):

405ebfcd18
d372b33c9b
36fa17a5fa
2012-07-01 16:38:26 +02:00

31 lines
450 B
PHP

--TEST--
json_encode() & endless loop - 1
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
$a = array();
$a[] = &$a;
var_dump($a);
var_dump(json_encode($a));
/* Break circular data structure to prevent memory leaks */
unset($a[0]);
echo "Done\n";
?>
--EXPECTF--
array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
Warning: json_encode(): recursion detected in %s on line %d
string(8) "[[null]]"
Done