dis-bench / src /php /php-src /ext /json /tests /bug62369.phpt
meddyrat's picture
Replace repository contents with the original corrected artifact
1e94262
Raw History Blame Contribute Delete
575 Bytes
--TEST--
FR #62369 (Segfault on json_encode(deeply_nested_array)
--FILE--
<?php
$array = array();
for ($i=0; $i < 550; $i++) {
$array = array($array);
}
json_encode($array, 0, 551);
switch (json_last_error()) {
case JSON_ERROR_NONE:
echo 'OK' . PHP_EOL;
break;
case JSON_ERROR_DEPTH:
echo 'ERROR' . PHP_EOL;
break;
}
json_encode($array, 0, 540);
switch (json_last_error()) {
case JSON_ERROR_NONE:
echo 'OK' . PHP_EOL;
break;
case JSON_ERROR_DEPTH:
echo 'ERROR' . PHP_EOL;
break;
}
?>
--EXPECT--
OK
ERROR