Skip to content

Commit 11b2cff

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: JIT: Fixed memory leak in Zend/tests/concat_002.phpt introduced by fac78ee
2 parents d56ec0a + 8965d6b commit 11b2cff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,10 +1162,13 @@ static void ZEND_FASTCALL zend_jit_fast_assign_concat_helper(zval *op1, zval *op
11621162

11631163
do {
11641164
if (Z_REFCOUNTED_P(op1)) {
1165-
if (GC_REFCOUNT(Z_STR_P(op1)) == 1 && EXPECTED(Z_STR_P(op1) != Z_STR_P(op2))) {
1165+
if (GC_REFCOUNT(Z_STR_P(op1)) == 1) {
11661166
result_str = perealloc(Z_STR_P(op1), ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(result_len)), 0);
11671167
ZSTR_LEN(result_str) = result_len;
11681168
zend_string_forget_hash_val(result_str);
1169+
if (UNEXPECTED(Z_STR_P(op1) == Z_STR_P(op2))) {
1170+
ZVAL_NEW_STR(op2, result_str);
1171+
}
11691172
break;
11701173
}
11711174
GC_DELREF(Z_STR_P(op1));

0 commit comments

Comments
 (0)