cvs: ZendEngine2 / zend_execute.c

From: Date: Sun, 16 Feb 2003 17:47:24 +0000
Subject: cvs: ZendEngine2 / zend_execute.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-933@lists.php.net to get a copy of this message
georg Sun Feb 16 12:47:24 2003 EDT Modified files: /ZendEngine2 zend_execute.c Log: tested patch from Zeev (fixes oo-bug in ext/mysqli) Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.426 ZendEngine2/zend_execute.c:1.427 --- ZendEngine2/zend_execute.c:1.426 Sun Feb 16 06:34:49 2003 +++ ZendEngine2/zend_execute.c Sun Feb 16 12:47:23 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.426 2003/02/16 11:34:49 sebastian Exp $ */ +/* $Id: zend_execute.c,v 1.427 2003/02/16 17:47:23 georg Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -197,7 +197,7 @@ if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) { variable_ptr_ptr = &EG(uninitialized_zval_ptr); /* } else if (variable_ptr==&EG(uninitialized_zval) || variable_ptr!=value_ptr) { */ - } else if (variable_ptr_ptr != value_ptr_ptr) { + } else if (variable_ptr != value_ptr) { variable_ptr->refcount--; if (variable_ptr->refcount==0) { zendi_zval_dtor(*variable_ptr); @@ -220,8 +220,15 @@ *variable_ptr_ptr = value_ptr; value_ptr->refcount++; } else { - if (variable_ptr->refcount>1) { /* we need to break away */ - SEPARATE_ZVAL(variable_ptr_ptr); + if (variable_ptr==EG(uninitialized_zval_ptr) + || variable_ptr->refcount>2) { + /* we need to separate */ + variable_ptr->refcount -= 2; + ALLOC_ZVAL(*variable_ptr_ptr); + **variable_ptr_ptr = *variable_ptr; + zval_copy_ctor(*variable_ptr_ptr); + *value_ptr_ptr = *variable_ptr_ptr; + (*variable_ptr_ptr)->refcount = 2; } (*variable_ptr_ptr)->is_ref = 1; } @@ -2587,6 +2594,11 @@ EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; + current_this = EG(This); + EG(This) = EX(object); + current_scope = EG(scope); + EG(scope) = EX(calling_scope); + if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); INIT_ZVAL(*(EX_T(EX(opline)->result.u.var).var.ptr)); @@ -2607,11 +2619,6 @@ } else if (EX(function_state).function->type == ZEND_USER_FUNCTION) { HashTable *calling_symbol_table; - current_this = EG(This); - EG(This) = EX(object); - current_scope = EG(scope); - EG(scope) = EX(calling_scope); - EX_T(EX(opline)->result.u.var).var.ptr = NULL; if (EG(symtable_cache_ptr)>=EG(symtable_cache)) { /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/ @@ -2649,11 +2656,6 @@ zend_hash_clean(*EG(symtable_cache_ptr)); } EG(active_symbol_table) = calling_symbol_table; - if (EG(This)) { - zval_ptr_dtor(&EG(This)); - } - EG(This) = current_this; - EG(scope) = current_scope; } else { /* ZEND_OVERLOADED_FUNCTION */ ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); INIT_ZVAL(*(EX_T(EX(opline)->result.u.var).var.ptr)); @@ -2670,6 +2672,11 @@ zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr); } } + if (EG(This)) { + zval_ptr_dtor(&EG(This)); + } + EG(This) = current_this; + EG(scope) = current_scope; zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc)); if(EG(active_namespace) != active_namespace) { @@ -3109,6 +3116,7 @@ } EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; ALLOC_ZVAL(EX_T(EX(opline)->result.u.var).var.ptr); + printf ("[zend - new handler]\n"); object_init_ex(EX_T(EX(opline)->result.u.var).var.ptr, EX_T(EX(opline)->op1.u.var).EA.class_entry); EX_T(EX(opline)->result.u.var).var.ptr->refcount=1; EX_T(EX(opline)->result.u.var).var.ptr->is_ref=1;

« previous php.zend-engine.cvs (#933) next »