--- /dev/null
+--TEST--
+Exception in compound assign op should prevent call to overloaded object handlers
+--FILE--
+<?php
+
+class Test {
+ public function __get($k) {
+ $this->$k = 42;
+ return 0;
+ }
+}
+
+$test = new ArrayObject;
+$test[0] = 42;
+try {
+ $test[0] %= 0;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+var_dump($test);
+
+$test2 = new Test;
+try {
+ $test2->prop %= 0;
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+var_dump($test2);
+
+?>
+--EXPECT--
+Modulo by zero
+object(ArrayObject)#1 (1) {
+ ["storage":"ArrayObject":private]=>
+ array(1) {
+ [0]=>
+ int(42)
+ }
+}
+Modulo by zero
+object(Test)#3 (1) {
+ ["prop"]=>
+ int(42)
+}
}
ZVAL_COPY_VALUE(z, value);
}
- binary_op(&res, Z_ISREF_P(z) ? Z_REFVAL_P(z) : z, value);
- Z_OBJ_HT_P(object)->write_dimension(object, property, &res);
+ if (binary_op(&res, Z_ISREF_P(z) ? Z_REFVAL_P(z) : z, value) == SUCCESS) {
+ Z_OBJ_HT_P(object)->write_dimension(object, property, &res);
+ }
if (z == &rv) {
zval_ptr_dtor(&rv);
}
}
ZVAL_COPY_VALUE(z, value);
}
- binary_op(&res, z, value);
- Z_OBJ_HT(obj)->write_property(&obj, property, &res, cache_slot);
+ if (binary_op(&res, z, value) == SUCCESS) {
+ Z_OBJ_HT(obj)->write_property(&obj, property, &res, cache_slot);
+ }
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), &res);
}