From: Andi Gutmans Date: Fri, 15 Mar 2002 15:28:06 +0000 (+0000) Subject: - Scope fix. When calling an imported function the scope will change X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1389 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db84afb206c8fe93539e9aa4465258ef6f8d7821;p=php - Scope fix. When calling an imported function the scope will change - correctly to the scope of the functions class. --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index ed3a25bc40..7e4db92732 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2003,8 +2003,6 @@ binary_assign_op_addr_obj: function_name_strlen = tmp.value.str.len; } - EX(calling_scope) = EG(scope); - if ((EX(object).ptr = EG(This))) { EX(object).ptr->refcount++; } @@ -2054,7 +2052,6 @@ binary_assign_op_addr_obj: function_name_strlen = tmp.value.str.len; } - EX(calling_scope) = EG(scope); do { if (EG(scope)) { @@ -2062,13 +2059,14 @@ binary_assign_op_addr_obj: if ((EX(object).ptr = EG(This))) { EX(object).ptr->refcount++; } + EX(calling_scope) = EG(scope); break; } } if (zend_hash_find(EG(function_table), function_name_strval, function_name_strlen+1, (void **) &function)==FAILURE) { zend_error(E_ERROR, "Call to undefined function: %s()", function_name_strval); } - EX(calling_scope) = NULL; + EX(calling_scope) = function->common.scope; EX(object).ptr = NULL; } while (0); @@ -2094,6 +2092,7 @@ binary_assign_op_addr_obj: if ((EX(object).ptr = EG(This))) { EX(object).ptr->refcount++; } + EX(calling_scope) = EG(scope); break; } } @@ -2101,9 +2100,9 @@ binary_assign_op_addr_obj: zend_error(E_ERROR, "Unknown function: %s()\n", fname->value.str.val); } EX(object).ptr = NULL; + EX(calling_scope) = EX(function_state).function->common.scope; } while (0); - EX(calling_scope) = EG(scope); FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1)); goto do_fcall_common;