summaryrefslogtreecommitdiff
path: root/ext/json/JSON_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/json/JSON_parser.c')
-rw-r--r--ext/json/JSON_parser.c2
1 files changed, 1 insertions, 1 deletions
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);