diff --git a/Zend/tests/bug79836_3.phpt b/Zend/tests/bug79836_3.phpt new file mode 100644 index 0000000000000..75262eb460fb4 --- /dev/null +++ b/Zend/tests/bug79836_3.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #79836 ($a .= $a should coerce to string) +--FILE-- + +--EXPECT-- +string(0) "" diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index c4fce74ebbbee..7e5e5ff3e0bdd 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2005,7 +2005,7 @@ ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval has_op2_string:; if (UNEXPECTED(ZSTR_LEN(op1_string) == 0)) { - if (EXPECTED(free_op2_string || result != op2)) { + if (EXPECTED(result != op2 || Z_TYPE_P(result) != IS_STRING)) { if (result == orig_op1) { i_zval_ptr_dtor(result); } @@ -2018,7 +2018,7 @@ has_op2_string:; } } } else if (UNEXPECTED(ZSTR_LEN(op2_string) == 0)) { - if (EXPECTED(free_op1_string || result != op1)) { + if (EXPECTED(result != op1 || Z_TYPE_P(result) != IS_STRING)) { if (result == orig_op1) { i_zval_ptr_dtor(result); }