Skip to content

Commit 5d983b2

Browse files
committed
Concatenating two valid UTF-8 strings produces a valid UTF-8 string
1 parent de59206 commit 5d983b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Zend/zend_operators.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,6 +1984,9 @@ ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval
19841984

19851985
memcpy(ZSTR_VAL(result_str) + op1_len, Z_STRVAL_P(op2), op2_len);
19861986
ZSTR_VAL(result_str)[result_len] = '\0';
1987+
if (ZSTR_IS_VALID_UTF8(Z_STR_P(op1)) && ZSTR_IS_VALID_UTF8(Z_STR_P(op2))) {
1988+
GC_ADD_FLAGS(result_str, IS_STR_VALID_UTF8);
1989+
}
19871990
}
19881991

19891992
zval_ptr_dtor_str(&op1_copy);

0 commit comments

Comments
 (0)