cvs: ZendEngine2 / zend_execute.c
| From: | Andi Gutmans | Date: | Fri, 15 Mar 2002 15:28:07 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-25@lists.php.net to get a copy of this message | ||
andi Fri Mar 15 10:28:07 2002 EDT
Modified files:
/ZendEngine2 zend_execute.c
Log:
- 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();
?>
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.335 ZendEngine2/zend_execute.c:1.336
--- ZendEngine2/zend_execute.c:1.335 Fri Mar 15 10:09:45 2002
+++ ZendEngine2/zend_execute.c Fri Mar 15 10:28:06 2002
@@ -2003,8 +2003,6 @@
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 @@
function_name_strlen = tmp.value.str.len;
}
- EX(calling_scope) = EG(scope);
do {
if (EG(scope)) {
@@ -2062,13 +2059,14 @@
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 @@
if ((EX(object).ptr = EG(This))) {
EX(object).ptr->refcount++;
}
+ EX(calling_scope) = EG(scope);
break;
}
}
@@ -2101,9 +2100,9 @@
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;