- Fixed altering $this via argument named "this". (Dmitry)
- Fixed PHP CLI usage of php.ini from the binary location. (Hannes)
- Fixed segfault in strripos(). (Tony, Joxean Koret)
+- Fixed bug #41673 (json_encode breaks large numbers in arrays). (Ilia)
- Fixed bug #41525 (ReflectionParameter::getPosition() not available). (Marcus)
- Fixed bug #41511 (Compile failure under IRIX 6.5.30 building md5.c). (Jani)
- Fixed bug #41504 (json_decode() incorrectly decodes JSON arrays with empty
if (type == IS_LONG)
{
- ZVAL_LONG(*z, atol(buf->c));
+ double d = zend_strtod(buf->c, NULL);
+ if (d > LONG_MAX) {
+ ZVAL_DOUBLE(*z, d);
+ } else {
+ ZVAL_LONG(*z, (long)d);
+ }
}
else if (type == IS_DOUBLE)
{
if (!zend_isinf(dbl) && !zend_isnan(dbl)) {
len = spprintf(&d, 0, "%.*g", (int) EG(precision), dbl);
- if (d) {
- if (dbl > LONG_MAX && !memchr(d, '.', len)) {
- smart_str_append_unsigned(buf, (unsigned long)Z_DVAL_P(val));
- } else {
- smart_str_appendl(buf, d, len);
- }
- efree(d);
- }
- }
- else
- {
+ smart_str_appendl(buf, d, len);
+ efree(d);
+ } else {
zend_error(E_WARNING, "[json] (json_encode_r) double %.9g does not conform to the JSON spec, encoded as 0.", dbl);
smart_str_appendc(buf, '0');
}