Merge branch 'PHP-8.0'

* PHP-8.0:
  Revert "Fix #79908: json_encode encodes negative zero as int"
This commit is contained in:
Christoph M. Becker 2021-07-20 00:30:37 +02:00
commit d2cc7239b7
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6
2 changed files with 1 additions and 14 deletions

View file

@ -84,8 +84,7 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options)
php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
len = strlen(num);
if ((options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH - 2)
|| (UNEXPECTED(len == 2 && num[0] == '-' && num[1] == '0'))) {
if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH - 2) {
num[len++] = '.';
num[len++] = '0';
num[len] = '\0';