--- /dev/null
+--TEST--
+GC 038: Garbage created by compound assignment operators (e.g. +=)
+--INI--
+zend.enable_gc = 1
+--FILE--
+<?php
+function test_add() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x += 5;
+ $n = gc_collect_cycles();
+ echo "+=\t$n\n";
+}
+test_add();
+
+function test_sub() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x -= 5;
+ $n = gc_collect_cycles();
+ echo "-=\t$n\n";
+}
+test_sub();
+
+function test_mul() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x *= 5;
+ $n = gc_collect_cycles();
+ echo "*=\t$n\n";
+}
+test_mul();
+
+function test_div() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x /= 5;
+ $n = gc_collect_cycles();
+ echo "/=\t$n\n";
+}
+test_div();
+
+function test_mod() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x %= 5;
+ $n = gc_collect_cycles();
+ echo "%=\t$n\n";
+}
+test_mod();
+
+function test_sl() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x <<= 5;
+ $n = gc_collect_cycles();
+ echo "<<=\t$n\n";
+}
+test_sl();
+
+function test_sr() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x >>= 5;
+ $n = gc_collect_cycles();
+ echo ">>=\t$n\n";
+}
+test_sr();
+
+function test_or() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x |= 1;
+ $n = gc_collect_cycles();
+ echo "|=\t$n\n";
+}
+test_or();
+
+function test_and() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x &= 1;
+ $n = gc_collect_cycles();
+ echo "&=\t$n\n";
+}
+test_and();
+
+function test_xor() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x ^= 1;
+ $n = gc_collect_cycles();
+ echo "^=\t$n\n";
+}
+test_xor();
+
+function test_pow() {
+ $x = new stdClass;
+ $x->x= $x;
+ @$x **= 1;
+ $n = gc_collect_cycles();
+ echo "**=\t$n\n";
+}
+test_pow();
+
+class Y {
+ function __toString() {
+ return "y";
+ }
+}
+function test_concat() {
+ $x = new Y;
+ $x->x= $x;
+ @$x .= "x";
+ $n = gc_collect_cycles();
+ echo ".=\t$n\n";
+}
+test_concat();
+?>
+--EXPECT--
++= 1
+-= 1
+*= 1
+/= 1
+%= 1
+<<= 1
+>>= 1
+|= 1
+&= 1
+^= 1
+**= 1
+.= 1
+
if (check && UNEXPECTED(EG(exception))) {
return;
}
- zval_dtor(op);
+ zval_ptr_dtor(op);
if (Z_TYPE(dst) == IS_LONG || Z_TYPE(dst) == IS_DOUBLE) {
ZVAL_COPY_VALUE(op, &dst);
}
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
if (op2_lval == -1) {
}
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
ZVAL_LONG(result, op1_lval | op2_lval);
return SUCCESS;
}
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
ZVAL_LONG(result, op1_lval & op2_lval);
return SUCCESS;
}
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
ZVAL_LONG(result, op1_lval ^ op2_lval);
return SUCCESS;
if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
if (EXPECTED(op2_lval > 0)) {
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
ZVAL_LONG(result, 0);
return SUCCESS;
}
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
ZVAL_LONG(result, op1_lval << op2_lval);
if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
if (EXPECTED(op2_lval > 0)) {
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
ZVAL_LONG(result, (op1_lval < 0) ? -1 : 0);
return SUCCESS;
}
if (op1 == result) {
- zval_dtor(result);
+ zval_ptr_dtor(result);
}
ZVAL_LONG(result, op1_lval >> op2_lval);
if (UNEXPECTED(Z_STRLEN_P(op1) == 0)) {
if (EXPECTED(result != op2)) {
if (result == orig_op1) {
- zval_dtor(orig_op1);
+ i_zval_ptr_dtor(result ZEND_FILE_LINE_CC);
}
ZVAL_COPY(result, op2);
}
result_str = zend_string_alloc(result_len, 0);
memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len);
if (result == orig_op1) {
- zval_dtor(orig_op1);
+ i_zval_ptr_dtor(result ZEND_FILE_LINE_CC);
}
}