1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Files
archived-php-src/ext/standard/tests/serialize/003.phpt
T
Nikita Popov a939805641 Use serialize_precision for var_dump()
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.
2020-02-25 09:51:32 +01:00

26 lines
432 B
PHP

--TEST--
unserialize() floats with E notation (#18654)
--INI--
precision=12
serialize_precision=100
--FILE--
<?php
foreach(array(1e2, 5.2e25, 85.29e-23, 9e-9) AS $value) {
echo ($ser = serialize($value))."\n";
var_dump(unserialize($ser));
echo "\n";
}
?>
--EXPECTREGEX--
d:100;
float\(100\)
d:5[0-9]*;
float\(5[0-9]*\)
d:8\.52[89][0-9]+E-22;
float\(8\.52[89][0-9]+E-22\)
d:8\.[9]*[0-9]*E-9;
float\(8\.[9]*[0-9]*E-9\)