mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
MFH Fix bug #47644 - Valid integers are truncated with json_decode()
This commit is contained in:
parent
1d5dbea704
commit
07e675cc52
2 changed files with 47 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue