From: Zeev Suraski Date: Thu, 23 Jan 2003 16:40:30 +0000 (+0000) Subject: Let the scope propagate to internal functions X-Git-Tag: PHP_5_0_dev_before_13561_fix~79 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76c93412d33ee90943dba50272ad6938f17ce5a7;p=php Let the scope propagate to internal functions --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index e6688be316..4c158ec846 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2549,11 +2549,6 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS) int return_value_used = RETURN_VALUE_USED(EX(opline)); zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *) EX(opline)->extended_value, NULL); - current_scope = EG(scope); - EG(scope) = EX(calling_scope); - - current_this = EG(This); - EG(This) = EX(object); EX_T(EX(opline)->result.u.var).var.ptr_ptr = &EX_T(EX(opline)->result.u.var).var.ptr; @@ -2577,6 +2572,11 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS) } 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]);*/ @@ -2614,6 +2614,11 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS) 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)); @@ -2636,14 +2641,6 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS) EG(function_state_ptr) = &EX(function_state); zend_ptr_stack_clear_multiple(TSRMLS_C); - EG(scope) = current_scope; - - if (EG(This)) { - zval_ptr_dtor(&EG(This)); - } - - EG(This) = current_this; - if (EG(exception)) { if (EX(opline)->op2.u.opline_num == -1) { RETURN_FROM_EXECUTE_LOOP(execute_data);