Skip to content

Commit 18abfcb

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

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

NEWS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ PHP NEWS
4747
. Fixed bug #68471 (IntlDateFormatter fails for "GMT+00:00" timezone). (cmb)
4848
. Fixed bug #74264 (grapheme_strrpos() broken for negative offsets). (cmb)
4949

50-
- JSON:
51-
. Fixed bug #79908 (json_encode encodes negative zero as int). (cmb)
52-
5350
- OpenSSL:
5451
. Fixed bug #52093 (openssl_csr_sign truncates $serial). (cmb)
5552

ext/json/json_encoder.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options)
102102

103103
php_gcvt(d, (int)PG(serialize_precision), '.', 'e', num);
104104
len = strlen(num);
105-
if ((options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH - 2)
106-
|| (UNEXPECTED(len == 2 && num[0] == '-' && num[1] == '0'))) {
105+
if (options & PHP_JSON_PRESERVE_ZERO_FRACTION && strchr(num, '.') == NULL && len < PHP_DOUBLE_MAX_LENGTH - 2) {
107106
num[len++] = '.';
108107
num[len++] = '0';
109108
num[len] = '\0';

ext/json/tests/bug79908.phpt

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)