dis-bench / src /php /php-src /ext /json /tests /003.phpt
meddyrat's picture
Replace repository contents with the original corrected artifact
1e94262
Raw History Blame Contribute Delete
495 Bytes
--TEST--
json_encode() & endless loop - 1
--FILE--
<?php
$a = array();
$a[] = &$a;
var_dump($a);
echo "\n";
var_dump(json_encode($a));
var_dump(json_last_error(), json_last_error_msg());
echo "\n";
var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR));
var_dump(json_last_error(), json_last_error_msg());
echo "Done\n";
?>
--EXPECTF--
array(1) {
[0]=>
*RECURSION*
}
bool(false)
int(6)
string(%d) "Recursion detected"
string(6) "[null]"
int(6)
string(%d) "Recursion detected"
Done