]> granicus.if.org Git - php/commitdiff
- This patch should hopefully fix situations where a constructor uses
authorAndi Gutmans <andi@php.net>
Mon, 14 Aug 2000 19:17:26 +0000 (19:17 +0000)
committerAndi Gutmans <andi@php.net>
Mon, 14 Aug 2000 19:17:26 +0000 (19:17 +0000)
- the $this pointer as a reference.

Zend/zend_compile.c
Zend/zend_execute.c

index 8e7f185b78b8a4cbf0d5fef1b3b59a73b3eb47e7..e2d8089f32610003d6de1405000c1924dbcc43cc 100644 (file)
@@ -1641,7 +1641,7 @@ void do_begin_new_object(znode *new_token, znode *class_name CLS_DC)
        unsigned char *ptr = NULL;
        
        opline->opcode = ZEND_NEW;
-       opline->result.op_type = IS_TMP_VAR;
+       opline->result.op_type = IS_VAR;
        opline->result.u.var = get_temporary_variable(CG(active_op_array));
        opline->op1 = *class_name;
        SET_UNUSED(opline->op2);
index 7ac697a0e765d6e83df68372a3ea0620d5e5c758..521eb2935d7fd42e0aec88b906ff77bbad3f5b8e 100644 (file)
@@ -1411,7 +1411,7 @@ binary_assign_op_addr: {
                                        if (opline->extended_value & ZEND_CTOR_CALL) {
                                                /* constructor call */
 
-                                               if (opline->op1.op_type == IS_VAR) {
+                                               if (opline->op1.op_type == IS_VAR && !(opline->op1.u.EA.type & EXT_TYPE_UNUSED)) {
                                                        PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr);
                                                }
                                                if (opline->op2.op_type==IS_VAR) {
@@ -1839,9 +1839,11 @@ send_by_ref:
                                        if (zend_hash_find(EG(class_table), class_name.value.str.val, class_name.value.str.len+1, (void **) &ce)==FAILURE) {
                                                zend_error(E_ERROR, "Cannot instantiate non-existent class:  %s", class_name.value.str.val);
                                        }
-                                       object_init_ex(&Ts[opline->result.u.var].tmp_var, ce);
-                                       Ts[opline->result.u.var].tmp_var.refcount=1;
-                                       Ts[opline->result.u.var].tmp_var.is_ref=1;
+                                       Ts[opline->result.u.var].var.ptr_ptr = &Ts[opline->result.u.var].var.ptr;
+                                       ALLOC_ZVAL(Ts[opline->result.u.var].var.ptr);
+                                       object_init_ex(Ts[opline->result.u.var].var.ptr, ce);
+                                       Ts[opline->result.u.var].var.ptr->refcount=1;
+                                       Ts[opline->result.u.var].var.ptr->is_ref=1;
                                        zval_dtor(&class_name);
                                        FREE_OP(&opline->op1, EG(free_op1));
                                }