diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2007-06-13 17:07:58 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2007-06-13 17:07:58 +0000 |
commit | 9f28e21bb1d8251229fd4f951ddc280c7dbea597 (patch) | |
tree | 490de1f31191a743126a937d1750cf249a13a574 /ext/json/json.c | |
parent | 1c7fa8fb4c3c1fb4bcd42a8421c29a1753e5d4bc (diff) | |
download | php-git-9f28e21bb1d8251229fd4f951ddc280c7dbea597.tar.gz |
Fixed bug #41673 (json_encode breaks large numbers in arrays).
Diffstat (limited to 'ext/json/json.c')
-rw-r--r-- | ext/json/json.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/ext/json/json.c b/ext/json/json.c index 737421f5ac..56507a2cbc 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -355,17 +355,9 @@ static void json_encode_r(smart_str *buf, zval *val TSRMLS_DC) { if (!zend_isinf(dbl) && !zend_isnan(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)); - } else { - smart_str_appendl(buf, d, len); - } - efree(d); - } - } - else - { + smart_str_appendl(buf, d, len); + efree(d); + } else { zend_error(E_WARNING, "[json] (json_encode_r) double %.9g does not conform to the JSON spec, encoded as 0.", dbl); smart_str_appendc(buf, '0'); } |