summaryrefslogtreecommitdiff
path: root/ext/json/JSON_parser.c
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2009-03-17 02:00:13 +0000
committerScott MacVicar <scottmac@php.net>2009-03-17 02:00:13 +0000
commit07e675cc52955329a24b38b51ec841675c0eb16d (patch)
treecd993cce7edc4e5ac864dd1b373541972087c336 /ext/json/JSON_parser.c
parent1d5dbea704dedba12d770f00ada2c6c932631e43 (diff)
downloadphp-git-07e675cc52955329a24b38b51ec841675c0eb16d.tar.gz
MFH Fix bug #47644 - Valid integers are truncated with json_decode()
Diffstat (limited to 'ext/json/JSON_parser.c')
-rw-r--r--ext/json/JSON_parser.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c
index edb1adf005..8eaf65e85c 100644
--- a/ext/json/JSON_parser.c
+++ b/ext/json/JSON_parser.c
@@ -289,11 +289,11 @@ 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 || d < LONG_MIN) {
- ZVAL_DOUBLE(*z, d);
+ long l = strtol(buf->c, NULL, 10);
+ if (l > LONG_MAX || l < LONG_MIN) {
+ ZVAL_DOUBLE(*z, zend_strtod(buf->c, NULL));
} else {
- ZVAL_LONG(*z, (long)d);
+ ZVAL_LONG(*z, l);
}
}
else if (type == IS_DOUBLE)