mirror of
https://github.com/php/php-src.git
synced 2026-04-19 22:11:12 +02:00
var_dump() is debugging functionality, so it should print floating-point numbers accurately. We do this by switching to serialize_precision, which (by default) will print with as much precision as necessary to preserve the exact value of the float. This also affects debug_zval_dump(). Closes GH-5172.
18 lines
419 B
PHP
18 lines
419 B
PHP
--TEST--
|
|
json_decode() with large integers
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("json")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
$json = '{"largenum":123456789012345678901234567890}';
|
|
$x = json_decode($json);
|
|
var_dump($x->largenum);
|
|
$x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
|
|
var_dump($x->largenum);
|
|
echo "Done\n";
|
|
?>
|
|
--EXPECT--
|
|
float(1.2345678901234568E+29)
|
|
string(30) "123456789012345678901234567890"
|
|
Done
|