zval rv;
if (Z_OBJ_HT_P(object)->read_property && Z_OBJ_HT_P(object)->write_property) {
- zval *z, obj;
+ zval *z, *zptr, obj;
ZVAL_OBJ(&obj, Z_OBJ_P(object));
Z_ADDREF(obj);
- z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
+ zptr = z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
OBJ_RELEASE(Z_OBJ(obj));
return;
}
Z_OBJ_HT(obj)->write_property(&obj, property, z, cache_slot);
OBJ_RELEASE(Z_OBJ(obj));
- zval_ptr_dtor(z);
+ zval_ptr_dtor(zptr);
} else {
zend_error(E_WARNING, "Attempt to increment/decrement property of non-object");
if (UNEXPECTED(result)) {
--- /dev/null
+--TEST--
+Operators on overlaoded property reference
+--FILE--
+<?php
+class C {
+ function __construct() { $this->bar = str_repeat("1", 2); }
+ function &__get($x) { return $this->bar; }
+ function __set($x, $v) { $this->bar = $v; }
+}
+$x = new C;
+var_dump(++$x->foo);
+$x = new C;
+var_dump($x->foo++);
+$x = new C;
+var_dump($x->foo += 2);
+?>
+--EXPECT--
+int(12)
+string(2) "11"
+int(13)