From: Ilia Alshanetsky Date: Wed, 13 Jun 2007 17:56:41 +0000 (+0000) Subject: Handle very small longs via double X-Git-Tag: php-5.2.4RC1~354 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c969e9005bffd9643b15bb1f9da634074efe7282;p=php Handle very small longs via double --- diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 9f46553f67..c054d5038e 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -285,7 +285,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type) if (type == IS_LONG) { double d = zend_strtod(buf->c, NULL); - if (d > LONG_MAX) { + if (d > LONG_MAX || d < -LONG_MAX) { ZVAL_DOUBLE(*z, d); } else { ZVAL_LONG(*z, (long)d);