cvs: ZendEngine2 / zend_execute.c
| From: | Zeev Suraski | Date: | Wed, 11 Feb 2004 15:56:13 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-2356@lists.php.net to get a copy of this message | ||
zeev Wed Feb 11 10:56:13 2004 EDT
Modified files:
/ZendEngine2 zend_execute.c
Log:
Fixed a bug the caused overloaded array indices to be converted to strings
http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.606&r2=1.607&ty=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.606 ZendEngine2/zend_execute.c:1.607
--- ZendEngine2/zend_execute.c:1.606 Wed Feb 11 10:50:23 2004
+++ ZendEngine2/zend_execute.c Wed Feb 11 10:56:13 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.606 2004/02/11 15:50:23 zeev Exp $ */
+/* $Id: zend_execute.c,v 1.607 2004/02/11 15:56:13 zeev Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -360,10 +360,9 @@
static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode *op2, znode
*value_op, temp_variable *Ts, int opcode TSRMLS_DC)
{
zval *object;
- zval *property = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
+ zval *property_name = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
zval *free_value;
zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
- zval tmp;
zval **retval = &T(result->u.var).var.ptr;
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
@@ -380,27 +379,10 @@
}
/* here we are sure we are dealing with an object */
- switch (op2->op_type) {
- case IS_CONST:
- /* already a constant string */
- break;
- case IS_VAR:
- tmp = *property;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- property = &tmp;
- break;
- case IS_TMP_VAR:
- convert_to_string(property);
- break;
- }
-
if (EG(implicit_clone)) {
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
object = *object_ptr;
}
- /* by now, property is a string */
-
/* separate our value if necessary */
if (value_op->op_type == IS_TMP_VAR) {
@@ -412,15 +394,32 @@
value->refcount = 0;
}
if (opcode == ZEND_ASSIGN_OBJ) {
- Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC);
+ zval tmp;
+
+ switch (op2->op_type) {
+ case IS_CONST:
+ /* already a constant string */
+ break;
+ case IS_VAR:
+ tmp = *property_name;
+ zval_copy_ctor(&tmp);
+ convert_to_string(&tmp);
+ property_name = &tmp;
+ break;
+ case IS_TMP_VAR:
+ convert_to_string(property_name);
+ break;
+ }
+ Z_OBJ_HT_P(object)->write_property(object, property_name, value TSRMLS_CC);
+ if (property_name == &tmp) {
+ zval_dtor(property_name);
+ }
} else {
+ /* Note: property_name in this case is really the array index! */
if (!Z_OBJ_HT_P(object)->write_dimension) {
zend_error(E_ERROR, "Cannot use object as array");
}
- Z_OBJ_HT_P(object)->write_dimension(object, property, value TSRMLS_CC);
- }
- if (property == &tmp) {
- zval_dtor(property);
+ Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
}
FREE_OP(Ts, op2, EG(free_op2));