diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c index 9de481fc1ea..02cfa335c3f 100644 --- a/ext/json/JSON_parser.c +++ b/ext/json/JSON_parser.c @@ -278,7 +278,7 @@ static void json_create_zval(zval **z, smart_str *buf, int type TSRMLS_DC) /* {{ if (type == IS_LONG) { double d = zend_strtod(buf->c, NULL); - if (d > LONG_MAX || d < -LONG_MAX) { + if (d > LONG_MAX || d < LONG_MIN) { ZVAL_DOUBLE(*z, d); } else { ZVAL_LONG(*z, (long)d);