summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-07-03 02:34:43 +0400
committerDmitry Stogov <dmitry@zend.com>2014-07-03 02:34:43 +0400
commitc4d99ec982e214d05b398694dc76a9caac16fbd1 (patch)
treeec5c9a08f9100325b1f3811ff71ad8c84ccbc07a
parent0a77dcd4b9046adb7c8f719ded19c5eff0c8976a (diff)
downloadphp-git-c4d99ec982e214d05b398694dc76a9caac16fbd1.tar.gz
Removed EG(called_scope) and use corresponding value from EG(current_execute_data)
-rw-r--r--Zend/zend_API.c10
-rw-r--r--Zend/zend_builtin_functions.c4
-rw-r--r--Zend/zend_constants.c4
-rw-r--r--Zend/zend_execute.c1
-rw-r--r--Zend/zend_execute_API.c14
-rw-r--r--Zend/zend_generators.c3
-rw-r--r--Zend/zend_globals.h1
-rw-r--r--Zend/zend_interfaces.c7
-rw-r--r--Zend/zend_vm_def.h13
-rw-r--r--Zend/zend_vm_execute.h39
-rw-r--r--Zend/zend_vm_execute.skl2
-rw-r--r--ext/phar/phar_object.c2
-rw-r--r--ext/spl/php_spl.c2
-rw-r--r--ext/standard/basic_functions.c12
14 files changed, 49 insertions, 65 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 6474fd6ad7..faf18252e4 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2770,7 +2770,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
if (!EG(scope)) {
if (error) *error = estrdup("cannot access self:: when no class scope is active");
} else {
- fcc->called_scope = EG(called_scope);
+ fcc->called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
fcc->calling_scope = EG(scope);
if (!fcc->object && Z_OBJ(EG(This))) {
fcc->object = Z_OBJ(EG(This));
@@ -2784,7 +2784,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
} else if (!EG(scope)->parent) {
if (error) *error = estrdup("cannot access parent:: when current class scope has no parent");
} else {
- fcc->called_scope = EG(called_scope);
+ fcc->called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
fcc->calling_scope = EG(scope)->parent;
if (!fcc->object && Z_OBJ(EG(This))) {
fcc->object = Z_OBJ(EG(This));
@@ -2794,11 +2794,11 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache
}
} else if (name_len == sizeof("static") - 1 &&
!memcmp(lcname->val, "static", sizeof("static") - 1)) {
- if (!EG(called_scope)) {
+ if (!EG(current_execute_data) || !EG(current_execute_data)->called_scope) {
if (error) *error = estrdup("cannot access static:: when no class scope is active");
} else {
- fcc->called_scope = EG(called_scope);
- fcc->calling_scope = EG(called_scope);
+ fcc->called_scope = EG(current_execute_data)->called_scope;
+ fcc->calling_scope = EG(current_execute_data)->called_scope;
if (!fcc->object && Z_OBJ(EG(This))) {
fcc->object = Z_OBJ(EG(This));
}
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index d6ca5c76d5..a9b7a6c12b 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -809,8 +809,8 @@ ZEND_FUNCTION(get_called_class)
return;
}
- if (EG(called_scope)) {
- RETURN_STR(STR_COPY(EG(called_scope)->name));
+ if (EG(current_execute_data)->called_scope) {
+ RETURN_STR(STR_COPY(EG(current_execute_data)->called_scope->name));
} else if (!EG(scope)) {
zend_error(E_WARNING, "get_called_class() called from outside a class");
}
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index 5366845519..650a566159 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -379,8 +379,8 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
}
} else if (class_name_len == sizeof("static")-1 &&
!memcmp(lcname, "static", sizeof("static")-1)) {
- if (EG(called_scope)) {
- ce = EG(called_scope);
+ if (EG(current_execute_data) && EG(current_execute_data)->called_scope) {
+ ce = EG(current_execute_data)->called_scope;
} else {
zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index e551ba67b2..b4e7f0e51a 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1547,7 +1547,6 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da
{
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
ZEND_ASSERT(EX(object) == Z_OBJ(EG(This)));
- ZEND_ASSERT(EX(called_scope) == EG(called_scope));
EX(return_value) = return_value;
EX(frame_kind) = frame_kind;
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index dc23ff85e0..d5bc4c5cf0 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -186,7 +186,6 @@ void init_executor(TSRMLS_D) /* {{{ */
EG(prev_exception) = NULL;
EG(scope) = NULL;
- EG(called_scope) = NULL;
ZVAL_OBJ(&EG(This), NULL);
@@ -662,12 +661,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_uint i;
zend_array *calling_symbol_table;
zend_class_entry *calling_scope = NULL;
- zend_class_entry *called_scope = NULL;
zend_execute_data *call, dummy_execute_data;
zend_fcall_info_cache fci_cache_local;
zend_function *func;
zend_object *orig_object;
- zend_class_entry *orig_scope, *orig_called_scope;
+ zend_class_entry *orig_scope;
zval tmp;
ZVAL_UNDEF(fci->retval);
@@ -690,7 +688,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
orig_object = Z_OBJ(EG(This));
orig_scope = EG(scope);
- orig_called_scope = EG(called_scope);
/* Initialize execute_data */
if (!EG(current_execute_data)) {
@@ -746,7 +743,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
func = fci_cache->function_handler;
call = zend_vm_stack_push_call_frame(func, fci->param_count, ZEND_CALL_DONE, fci_cache->called_scope, fci_cache->object, NULL TSRMLS_CC);
calling_scope = fci_cache->calling_scope;
- called_scope = fci_cache->called_scope;
fci->object = fci_cache->object;
if (fci->object &&
(!EG(objects_store).object_buckets ||
@@ -839,7 +835,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
call->num_args = fci->param_count;
EG(scope) = calling_scope;
- EG(called_scope) = called_scope;
if (!fci->object ||
(func->common.fn_flags & ZEND_ACC_STATIC)) {
Z_OBJ(EG(This)) = call->object = NULL;
@@ -942,7 +937,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
Z_OBJ(EG(This)) = orig_object;
EG(scope) = orig_scope;
- EG(called_scope) = orig_called_scope;
if (EG(current_execute_data) == &dummy_execute_data) {
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
}
@@ -1120,7 +1114,7 @@ ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *s
ZVAL_UNDEF(&local_retval);
if (EG(current_execute_data)) {
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
}
zend_execute(new_op_array, &local_retval TSRMLS_CC);
} zend_catch {
@@ -1494,10 +1488,10 @@ check_fetch_type:
}
return EG(scope)->parent;
case ZEND_FETCH_CLASS_STATIC:
- if (!EG(called_scope)) {
+ if (!EG(current_execute_data) || !EG(current_execute_data)->called_scope) {
zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
}
- return EG(called_scope);
+ return EG(current_execute_data)->called_scope;
case ZEND_FETCH_CLASS_AUTO: {
fetch_type = zend_get_class_fetch_type(class_name->val, class_name->len);
if (fetch_type!=ZEND_FETCH_CLASS_DEFAULT) {
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index 4505081ee2..c529646730 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -314,7 +314,6 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
zend_array *original_active_symbol_table = EG(active_symbol_table);
zend_object *original_This;
zend_class_entry *original_scope = EG(scope);
- zend_class_entry *original_called_scope = EG(called_scope);
zend_vm_stack original_stack = EG(argument_stack);
original_This = Z_OBJ(EG(This));
@@ -324,7 +323,6 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
EG(active_symbol_table) = generator->execute_data->symbol_table;
Z_OBJ(EG(This)) = generator->execute_data->object;
EG(scope) = generator->execute_data->scope;
- EG(called_scope) = generator->execute_data->called_scope;
EG(argument_stack) = generator->stack;
/* We want the backtrace to look as if the generator function was
@@ -353,7 +351,6 @@ ZEND_API void zend_generator_resume(zend_generator *generator TSRMLS_DC) /* {{{
EG(active_symbol_table) = original_active_symbol_table;
Z_OBJ(EG(This)) = original_This;
EG(scope) = original_scope;
- EG(called_scope) = original_called_scope;
EG(argument_stack) = original_stack;
/* If an exception was thrown in the generator we have to internally
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 6792811003..2bfd933944 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -186,7 +186,6 @@ struct _zend_executor_globals {
HashTable *zend_constants; /* constants table */
zend_class_entry *scope;
- zend_class_entry *called_scope; /* Scope of the calling class */
zval This;
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c
index ded81e2918..d5420dae76 100644
--- a/Zend/zend_interfaces.c
+++ b/Zend/zend_interfaces.c
@@ -90,11 +90,12 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun
if (object) {
fcic.called_scope = Z_OBJCE_P(object);
} else if (obj_ce &&
- !(EG(called_scope) &&
- instanceof_function(EG(called_scope), obj_ce TSRMLS_CC))) {
+ !(EG(current_execute_data) &&
+ EG(current_execute_data)->called_scope &&
+ instanceof_function(EG(current_execute_data)->called_scope, obj_ce TSRMLS_CC))) {
fcic.called_scope = obj_ce;
} else {
- fcic.called_scope = EG(called_scope);
+ fcic.called_scope = EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL;
}
fcic.object = object ? Z_OBJ_P(object) : NULL;
result = zend_call_function(&fci, &fcic TSRMLS_CC);
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 0cd5419d9c..1cdc5d3021 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1808,7 +1808,6 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_op *opline = EX(opline);
@@ -2365,7 +2364,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS
if (OP1_TYPE != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -2620,7 +2619,8 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
#else
EG(scope) = fbc->common.scope;
#endif
- EG(called_scope) = call->called_scope;
+ } else {
+ call->called_scope = EX(called_scope);
}
call->opline = NULL;
@@ -2681,7 +2681,6 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
Z_OBJ(EG(This)) = call->object;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
EG(active_symbol_table) = NULL;
if (RETURN_VALUE_USED(opline)) {
return_value = EX_VAR(opline->result.var);
@@ -2716,7 +2715,6 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
Z_OBJ(EG(This)) = call->object;
//??? EG(scope) = NULL;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -2769,7 +2767,6 @@ ZEND_VM_C_LABEL(fcall_end_change_scope):
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
ZEND_VM_C_LABEL(fcall_end):
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -3986,7 +3983,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -5346,7 +5343,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
closure_is_static = Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC;
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->call->func->common.fn_flags & ZEND_ACC_STATIC;
if (closure_is_static || closure_is_being_defined_inside_static_context) {
- zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(called_scope), NULL TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
} else {
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), Z_OBJ(EG(This)) ? &EG(This) : NULL TSRMLS_CC);
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 57fb40bc13..28804bf542 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -380,7 +380,7 @@ ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC
execute_data = EG(current_execute_data)->call;
} else {
execute_data = zend_vm_stack_push_call_frame(
- (zend_function*)op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), NULL TSRMLS_CC);
+ (zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
}
EX(prev_execute_data) = EG(current_execute_data);
i_init_execute_data(execute_data, op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
@@ -426,7 +426,6 @@ static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
if (UNEXPECTED(EG(exception) != NULL)) {
zend_op *opline = EX(opline);
@@ -567,7 +566,8 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
#else
EG(scope) = fbc->common.scope;
#endif
- EG(called_scope) = call->called_scope;
+ } else {
+ call->called_scope = EX(called_scope);
}
call->opline = NULL;
@@ -628,7 +628,6 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
Z_OBJ(EG(This)) = call->object;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
EG(active_symbol_table) = NULL;
if (RETURN_VALUE_USED(opline)) {
return_value = EX_VAR(opline->result.var);
@@ -663,7 +662,6 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
Z_OBJ(EG(This)) = call->object;
//??? EG(scope) = NULL;
EG(scope) = fbc->common.scope;
- EG(called_scope) = call->called_scope;
ZVAL_NULL(EX_VAR(opline->result.var));
@@ -716,7 +714,6 @@ fcall_end_change_scope:
}
Z_OBJ(EG(This)) = EX(object);
EG(scope) = EX(scope);
- EG(called_scope) = EX(called_scope);
fcall_end:
if (UNEXPECTED(EG(exception) != NULL)) {
@@ -2921,7 +2918,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -3804,7 +3801,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -4770,7 +4767,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -5604,7 +5601,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -6297,7 +6294,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -6594,7 +6591,7 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
closure_is_static = Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC;
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->call->func->common.fn_flags & ZEND_ACC_STATIC;
if (closure_is_static || closure_is_being_defined_inside_static_context) {
- zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(called_scope), NULL TSRMLS_CC);
+ zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EX(called_scope), NULL TSRMLS_CC);
} else {
zend_create_closure(EX_VAR(opline->result.var), Z_FUNC_P(zfunc), EG(scope), Z_OBJ(EG(This)) ? &EG(This) : NULL TSRMLS_CC);
}
@@ -7126,7 +7123,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN
if (IS_CONST != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -8112,7 +8109,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -13370,7 +13367,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
@@ -15415,7 +15412,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -17643,7 +17640,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -19838,7 +19835,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -21302,7 +21299,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -23205,7 +23202,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_
if (IS_VAR != IS_CONST) {
/* previous opcode is ZEND_FETCH_CLASS */
if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
- ce = EG(called_scope);
+ ce = EX(called_scope);
}
}
@@ -30500,7 +30497,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
}
EX(call) = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EX(called_scope), Z_OBJ(EG(This)), EX(call) TSRMLS_CC);
if (!EG(active_symbol_table)) {
zend_rebuild_symbol_table(TSRMLS_C);
diff --git a/Zend/zend_vm_execute.skl b/Zend/zend_vm_execute.skl
index 656c0fcd9e..ae5bac4db3 100644
--- a/Zend/zend_vm_execute.skl
+++ b/Zend/zend_vm_execute.skl
@@ -39,7 +39,7 @@ ZEND_API void zend_{%EXECUTOR_NAME%}(zend_op_array *op_array, zval *return_value
execute_data = EG(current_execute_data)->call;
} else {
execute_data = zend_vm_stack_push_call_frame(
- (zend_function*)op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), NULL TSRMLS_CC);
+ (zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
}
EX(prev_execute_data) = EG(current_execute_data);
i_init_execute_data(execute_data, op_array, return_value, EG(active_symbol_table) ? VM_FRAME_TOP_CODE : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 6bacbab146..aa63f8f338 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -287,7 +287,7 @@ static int phar_file_action(phar_archive_data *phar, phar_entry_info *info, char
zend_try {
if (EG(current_execute_data)) {
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
}
zend_execute(new_op_array, &result TSRMLS_CC);
if (PHAR_G(cwd)) {
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 8bab4ae3cf..3730adc699 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -293,7 +293,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
ZVAL_UNDEF(&result);
if (EG(current_execute_data)) {
EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
+ (zend_function*)new_op_array, 0, 0, EG(current_execute_data)->called_scope, Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
}
zend_execute(new_op_array, &result TSRMLS_CC);
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 5fe17c88fb..644e364f21 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4765,9 +4765,9 @@ PHP_FUNCTION(forward_static_call)
fci.retval = &retval;
- if (EG(called_scope) &&
- instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) {
- fci_cache.called_scope = EG(called_scope);
+ if (EG(current_execute_data)->called_scope &&
+ instanceof_function(EG(current_execute_data)->called_scope, fci_cache.calling_scope TSRMLS_CC)) {
+ fci_cache.called_scope = EG(current_execute_data)->called_scope;
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {
@@ -4791,9 +4791,9 @@ PHP_FUNCTION(forward_static_call_array)
zend_fcall_info_args(&fci, params TSRMLS_CC);
fci.retval = &retval;
- if (EG(called_scope) &&
- instanceof_function(EG(called_scope), fci_cache.calling_scope TSRMLS_CC)) {
- fci_cache.called_scope = EG(called_scope);
+ if (EG(current_execute_data)->called_scope &&
+ instanceof_function(EG(current_execute_data)->called_scope, fci_cache.calling_scope TSRMLS_CC)) {
+ fci_cache.called_scope = EG(current_execute_data)->called_scope;
}
if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && Z_TYPE(retval) != IS_UNDEF) {