mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
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:
parent
ef9014d95d
commit
47ae4068bb
24
ext/standard/tests/serialize/003.phpt
Normal file
24
ext/standard/tests/serialize/003.phpt
Normal 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)
|
@ -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];
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user