diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index ca78b0b0820..297cf30161b 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1162,10 +1162,13 @@ static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op do { if (Z_REFCOUNTED_P(op1)) { - if (GC_REFCOUNT(Z_STR_P(op1)) == 1 && EXPECTED(Z_STR_P(op1) != Z_STR_P(op2))) { + if (GC_REFCOUNT(Z_STR_P(op1)) == 1) { result_str = perealloc(Z_STR_P(op1), ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(result_len)), 0); ZSTR_LEN(result_str) = result_len; zend_string_forget_hash_val(result_str); + if (UNEXPECTED(Z_STR_P(op1) == Z_STR_P(op2))) { + ZVAL_NEW_STR(op2, result_str); + } break; } GC_DELREF(Z_STR_P(op1));