Skip to content

Commit ee74f2e

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fixed bug #81090
2 parents 76a4ea5 + 82f6f6d commit ee74f2e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77
(krakjoe)
88
. Fixed bug #81068 (Double free in realpath_cache_clean()). (Dimitry Andric)
99
. Fixed bug #76359 (open_basedir bypass through adding ".."). (cmb)
10+
. Fixed bug #81090 (Typed property performance degradation with .= operator).
11+
(Nikita)
1012

1113
- OCI8:
1214
. Fixed bug #81088 (error in regression test for oci_fetch_object() and

Zend/zend_execute.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,13 @@ static zend_never_inline void zend_binary_assign_op_typed_ref(zend_reference *re
13291329
{
13301330
zval z_copy;
13311331

1332+
/* Make sure that in-place concatenation is used if the LHS is a string. */
1333+
if (opline->extended_value == ZEND_CONCAT && Z_TYPE(ref->val) == IS_STRING) {
1334+
concat_function(&ref->val, &ref->val, value);
1335+
ZEND_ASSERT(Z_TYPE(ref->val) == IS_STRING && "Concat should return string");
1336+
return;
1337+
}
1338+
13321339
zend_binary_op(&z_copy, &ref->val, value OPLINE_CC);
13331340
if (EXPECTED(zend_verify_ref_assignable_zval(ref, &z_copy, EX_USES_STRICT_TYPES()))) {
13341341
zval_ptr_dtor(&ref->val);
@@ -1342,6 +1349,13 @@ static zend_never_inline void zend_binary_assign_op_typed_prop(zend_property_inf
13421349
{
13431350
zval z_copy;
13441351

1352+
/* Make sure that in-place concatenation is used if the LHS is a string. */
1353+
if (opline->extended_value == ZEND_CONCAT && Z_TYPE_P(zptr) == IS_STRING) {
1354+
concat_function(zptr, zptr, value);
1355+
ZEND_ASSERT(Z_TYPE_P(zptr) == IS_STRING && "Concat should return string");
1356+
return;
1357+
}
1358+
13451359
zend_binary_op(&z_copy, zptr, value OPLINE_CC);
13461360
if (EXPECTED(zend_verify_property_type(prop_info, &z_copy, EX_USES_STRICT_TYPES()))) {
13471361
zval_ptr_dtor(zptr);

0 commit comments

Comments
 (0)