diff options
author | Jakub Zelenka <bukka@php.net> | 2016-06-26 12:29:57 +0100 |
---|---|---|
committer | Jakub Zelenka <bukka@php.net> | 2016-06-26 13:26:43 +0100 |
commit | 71774c241e289e6c7a4159fe53cc832742deaa3d (patch) | |
tree | d035d255a4fbd5fb8edbc2c9f03c354632461d2d /ext/standard/var.c | |
parent | 75b86a2c22a5484c34acbbaa47520a05b3a6f5f0 (diff) | |
download | php-git-71774c241e289e6c7a4159fe53cc832742deaa3d.tar.gz |
Add decimal point in double serialization
Diffstat (limited to 'ext/standard/var.c')
-rw-r--r-- | ext/standard/var.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/ext/standard/var.c b/ext/standard/var.c index 7b0b5daa2b..e0938fe6e9 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -468,22 +468,17 @@ again: smart_str_append_long(buf, Z_LVAL_P(struc)); break; case IS_DOUBLE: - /* TODO: check INF, -INF and NAN in the new logic - tmp_len = spprintf(&tmp_str, 0,"%.*H", PG(serialize_precision), Z_DVAL_P(struc)); - smart_str_appendl(buf, tmp_str, tmp_len); - * Without a decimal point, PHP treats a number literal as an int. + php_gcvt(Z_DVAL_P(struc), (int)PG(serialize_precision), '.', 'E', tmp_str); + smart_str_appends(buf, tmp_str); + /* Without a decimal point, PHP treats a number literal as an int. * This check even works for scientific notation, because the * mantissa always contains a decimal point. * We need to check for finiteness, because INF, -INF and NAN * must not have a decimal point added. - * + */ if (zend_finite(Z_DVAL_P(struc)) && NULL == strchr(tmp_str, '.')) { smart_str_appendl(buf, ".0", 2); } - efree(tmp_str); - */ - php_gcvt(Z_DVAL_P(struc), (int)PG(serialize_precision), '.', 'E', tmp_str); - smart_str_appends(buf, tmp_str); break; case IS_STRING: ztmp = php_addcslashes(Z_STR_P(struc), 0, "'\\", 2); |