Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsdos committed Feb 6, 2025
1 parent df0117e commit 246b413
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ext/json/json_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ zend_result php_json_escape_string(
#endif

us = (unsigned char)s[pos];
if (EXPECTED(result != PHP_JSON_NON_ASCII && !ZEND_BIT_TEST(charmap, us))) {
if (result != PHP_JSON_NON_ASCII && EXPECTED(!ZEND_BIT_TEST(charmap, us))) {
pos++;
len--;
} else {
Expand All @@ -695,9 +695,9 @@ zend_result php_json_escape_string(
if (UNEXPECTED(!us)) {
if (pos_old && (options & (PHP_JSON_INVALID_UTF8_IGNORE|PHP_JSON_INVALID_UTF8_SUBSTITUTE))) {
php_json_append(buf, s, pos_old);
s += pos;
pos = 0;
}
s += pos;
pos = 0;

if (options & PHP_JSON_INVALID_UTF8_IGNORE) {
/* ignore invalid UTF8 character */
Expand Down

0 comments on commit 246b413

Please # to comment.