mirror of
https://github.com/php/php-src.git
synced 2025-01-27 06:03:45 +08:00
40 lines
538 B
PHP
40 lines
538 B
PHP
--TEST--
|
|
json_encode() & endless loop - 3
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("json")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$a = array();
|
|
$a[] = $a;
|
|
|
|
var_dump($a);
|
|
var_dump(json_encode($a));
|
|
|
|
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
|
|
--UEXPECTF--
|
|
array(1) {
|
|
[0]=>
|
|
array(1) {
|
|
[0]=>
|
|
*RECURSION*
|
|
}
|
|
}
|
|
|
|
Warning: json_encode(): recursion detected in %s on line %d
|
|
unicode(8) "[[null]]"
|
|
Done
|