cvs: ZendEngine2 / zend_execute.c
| From: | Zeev Suraski | Date: | Tue, 10 Feb 2004 09:29:42 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2335@lists.php.net to get a copy of this message | ||
zeev Tue Feb 10 04:29:42 2004 EDT
Modified files:
/ZendEngine2 zend_execute.c
Log:
- Fix pre/post increment for overloaded objects
- Fix binary-assign-op for overloaded objects
NOTE: This requires the implementation of the 'get' callback!
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.599&r2=1.600&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.599 ZendEngine2/zend_execute.c:1.600
--- ZendEngine2/zend_execute.c:1.599 Sun Feb 8 12:23:20 2004
+++ ZendEngine2/zend_execute.c Tue Feb 10 04:29:42 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.599 2004/02/08 17:23:20 zeev Exp $ */
+/* $Id: zend_execute.c,v 1.600 2004/02/10 09:29:42 zeev Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -1106,11 +1106,24 @@
if (!have_get_ptr) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, 0 TSRMLS_CC);
+
+ if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
+ zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
+
+ if (z->refcount == 0) {
+ zval_dtor(z);
+ FREE_ZVAL(z);
+ }
+ z = value;
+ }
SEPARATE_ZVAL_IF_NOT_REF(&z);
incdec_op(z);
+ *retval = z;
Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- if (z->refcount <= 1) {
+ SELECTIVE_PZVAL_LOCK(*retval, result);
+ if (z->refcount == 0) {
zval_dtor(z);
+ FREE_ZVAL(z);
}
}
@@ -1153,13 +1166,23 @@
if (!have_get_ptr) {
zval *z = Z_OBJ_HT_P(object)->read_property(object, property, 0 TSRMLS_CC);
- SEPARATE_ZVAL_IF_NOT_REF(&z);
+
+ if (z->type == IS_OBJECT && Z_OBJ_HT_P(object)->get) {
+ zval *value = Z_OBJ_HT_P(object)->get(z TSRMLS_CC);
+
+ if (z->refcount == 0) {
+ zval_dtor(z);
+ FREE_ZVAL(z);
+ }
+ z = value;
+ }
*retval = *z;
zendi_zval_copy_ctor(*retval);
incdec_op(z);
Z_OBJ_HT_P(object)->write_property(object, property, z TSRMLS_CC);
- if (z->refcount <= 1) {
+ if (z->refcount == 0) {
zval_dtor(z);
+ FREE_ZVAL(z);
}
}
@@ -1560,6 +1583,15 @@
z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_W TSRMLS_CC);
break;
}
+ if (z->type == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
+ zval *value = Z_OBJ_HT_P(z)->get(z TSRMLS_CC);
+
+ if (z->refcount == 0) {
+ zval_dtor(z);
+ FREE_ZVAL(z);
+ }
+ z = value;
+ }
SEPARATE_ZVAL_IF_NOT_REF(&z);
binary_op(z, z, value TSRMLS_CC);
switch (opline->extended_value) {
@@ -1572,8 +1604,9 @@
}
*retval = z;
SELECTIVE_PZVAL_LOCK(*retval, result);
- if (z->refcount <= 1) {
+ if (z->refcount == 0) {
zval_dtor(z);
+ FREE_ZVAL(z);
}
}