From 246b413c2ea8971575ef6fe0c3f44af7304ee947 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Thu, 6 Feb 2025 21:36:59 +0100 Subject: [PATCH] tweaks --- ext/json/json_encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c index 0cd76afb4f278..e9e0a6a9aa645 100644 --- a/ext/json/json_encoder.c +++ b/ext/json/json_encoder.c @@ -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 { @@ -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 */