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_parser.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_parser.c')
-rw-r--r-- | ext/json/JSON_parser.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 2f2d268125..9f46553f67 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -284,7 +284,12 @@ static void json_create_zval(zval **z, smart_str *buf, int type) if (type == IS_LONG) { - ZVAL_LONG(*z, atol(buf->c)); + double d = zend_strtod(buf->c, NULL); + if (d > LONG_MAX) { + ZVAL_DOUBLE(*z, d); + } else { + ZVAL_LONG(*z, (long)d); + } } else if (type == IS_DOUBLE) { |