diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2007-06-04 23:51:32 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2007-06-04 23:51:32 +0000 |
commit | 045b283a7d014deb38e7f8763d3ad098efce2afd (patch) | |
tree | 90e78494a2de84373eea9a6baf7b43fa7a462317 /ext/json/json.c | |
parent | bd7c9ebeb0bc767a2a84d24ebe554e029748764d (diff) | |
download | php-git-045b283a7d014deb38e7f8763d3ad098efce2afd.tar.gz |
Fixed bug #41567 (json_encode() double conversion is inconsistent with PHP).
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index fefdf9601e..737421f5ac 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -354,7 +354,7 @@ static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC) { double dbl = Z_DVAL_P(val); if (!zend_isinf(dbl) && !zend_isnan(dbl)) { - len = spprintf(&d, 0, "%.9g", dbl); + len = spprintf(&d, 0, "%.*g", (int) EG(precision), dbl); if (d) { if (dbl > LONG_MAX && !memchr(d, '.', len)) { smart_str_append_unsigned(buf, (unsigned long)Z_DVAL_P(val)); |