diff options
author | Andi Gutmans <andi@php.net> | 2002-03-15 15:28:06 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2002-03-15 15:28:06 +0000 |
commit | db84afb206c8fe93539e9aa4465258ef6f8d7821 (patch) | |
tree | 4524428cc99b2be9a55ba520ca6b87d3fd470472 /Zend | |
parent | 716e6a03db7639b4b9df1c58f6929c356e9ac765 (diff) | |
download | php-git-db84afb206c8fe93539e9aa4465258ef6f8d7821.tar.gz |
- Scope fix. When calling an imported function the scope will change
- correctly to the scope of the functions class.
<?php
function Hello()
{
print "Wrong one\n";
}
class MyClass {
static $hello = "Hello, World\n";
function Hello()
{
print self::$hello;
}
function Trampoline()
{
Hello();
}
}
import function Trampoline from MyClass;
Trampoline();
?>
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_execute.c | 9 |
1 files changed, 4 insertions, 5 deletions
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; |