Made unserialize handle floats with an E notation - bug #18654

Patch by Christophe Sollet <csollet@coleebris.com>.
(I'll commit a new var_unserializer.c in a second)
This commit is contained in:
Sander Roobol 2002-08-19 19:45:46 +00:00
parent ef9014d95d
commit 47ae4068bb
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,24 @@
--TEST--
unserialize() floats with E notation (#18654)
--POST--
--GET--
--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";
}
?>
--EXPECT--
d:100;
float(100)
d:5.2E+25;
float(5.2E+25)
d:8.529E-22;
float(8.529E-22)
d:9E-09;
float(9.E-9)

View File

@ -92,7 +92,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx)
/*!re2c
iv = [+-]? [0-9]+;
nv = [+-]? ([0-9]* "." [0-9]+|[0-9]+ "." [0-9]+);
nvexp = nv [eE] [+-]? iv;
nvexp = (iv | nv) [eE] [+-]? iv;
any = [\000-\277];
*/