Skip to content

Commit d2cc723

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Revert "Fix #79908: json_encode encodes negative zero as int"
2 parents 0ce1cd1 + 18abfcb commit d2cc723

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

ext/json/json_encoder.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options)
8484

8585
php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
8686
len = strlen(num);
87-
if ((options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH - 2)
88-
|| (UNEXPECTED(len == 2 && num[0] == '-' && num[1] == '0'))) {
87+
if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH - 2) {
8988
num[len++] = '.';
9089
num[len++] = '0';
9190
num[len] = '\0';

ext/json/tests/bug79908.phpt

-12
This file was deleted.

0 commit comments

Comments
 (0)