]> granicus.if.org Git - php/commitdiff
Fix assignments to $this.
authorZeev Suraski <zeev@php.net>
Wed, 29 Jan 2003 08:55:12 +0000 (08:55 +0000)
committerZeev Suraski <zeev@php.net>
Wed, 29 Jan 2003 08:55:12 +0000 (08:55 +0000)
Fixes the 'make install' problem reported on php-dev

Zend/zend_execute.c
Zend/zend_object_handlers.c

index 87a30234319c403d214a06c648a94d5220ff3780..dedc2e53fdc5d7eaf220c6f31b26e54dbd1f67c3 100644 (file)
@@ -310,8 +310,18 @@ static inline void zend_assign_to_object(znode *result, znode *op1, znode *op2,
                SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
                object = *object_ptr;
        }
+       /* by now, property is a string */
 
-       /* here property is a string */
+
+       /* separate our value if necessary */
+       if (value_op->op_type == IS_TMP_VAR) {
+               zval *orig_value = value;
+
+               ALLOC_ZVAL(value);
+               *value = *orig_value;
+               value->is_ref = 0;
+               value->refcount = 0;
+       }
        Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC);
        if (property == &tmp) {
                zval_dtor(property);
index 4720a8bfba8ea6b5f7a4c27e3fee214a0c6705da..ff5764e6b01527cb92c49f2e7a974974603e9157 100644 (file)
@@ -220,7 +220,9 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
                                /* To check: can't *variable_ptr be some system variable like error_zval here? */
                                (*variable_ptr)->type = value->type;
                                (*variable_ptr)->value = value->value;
-                               zval_copy_ctor(*variable_ptr);
+                               if (value->refcount>0) {
+                                       zval_copy_ctor(*variable_ptr);
+                               }
                                setter_done = 1;
                        }
                }