Skip to content

Commit 445b649

Browse files
committed
Fix bug #81090 in JIT as well
1 parent c27dedb commit 445b649

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,13 @@ static void ZEND_FASTCALL zend_jit_assign_op_to_typed_ref(zend_reference *ref, z
19181918
{
19191919
zval z_copy;
19201920

1921+
/* Make sure that in-place concatenation is used if the LHS is a string. */
1922+
if (binary_op == concat_function && Z_TYPE(ref->val) == IS_STRING) {
1923+
concat_function(&ref->val, &ref->val, val);
1924+
ZEND_ASSERT(Z_TYPE(ref->val) == IS_STRING && "Concat should return string");
1925+
return;
1926+
}
1927+
19211928
binary_op(&z_copy, &ref->val, val);
19221929
if (EXPECTED(zend_verify_ref_assignable_zval(ref, &z_copy, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
19231930
zval_ptr_dtor(&ref->val);
@@ -2117,6 +2124,13 @@ static void ZEND_FASTCALL zend_jit_assign_op_to_typed_prop(zval *zptr, zend_prop
21172124
zval z_copy;
21182125

21192126
ZVAL_DEREF(zptr);
2127+
/* Make sure that in-place concatenation is used if the LHS is a string. */
2128+
if (binary_op == concat_function && Z_TYPE_P(zptr) == IS_STRING) {
2129+
concat_function(zptr, zptr, value);
2130+
ZEND_ASSERT(Z_TYPE_P(zptr) == IS_STRING && "Concat should return string");
2131+
return;
2132+
}
2133+
21202134
binary_op(&z_copy, zptr, value);
21212135
if (EXPECTED(zend_verify_property_type(prop_info, &z_copy, EX_USES_STRICT_TYPES()))) {
21222136
zval_ptr_dtor(zptr);

0 commit comments

Comments
 (0)