]> granicus.if.org Git - php/commitdiff
Removed EG(called_scope) and use corresponding value from EG(current_execute_data)
authorDmitry Stogov <dmitry@zend.com>
Wed, 2 Jul 2014 22:34:43 +0000 (02:34 +0400)
committerDmitry Stogov <dmitry@zend.com>
Wed, 2 Jul 2014 22:34:43 +0000 (02:34 +0400)
14 files changed:
Zend/zend_API.c
Zend/zend_builtin_functions.c
Zend/zend_constants.c
Zend/zend_execute.c
Zend/zend_execute_API.c
Zend/zend_generators.c
Zend/zend_globals.h
Zend/zend_interfaces.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Zend/zend_vm_execute.skl
ext/phar/phar_object.c
ext/spl/php_spl.c
ext/standard/basic_functions.c

index 6474fd6ad7012ce4b119a55b132acb63b8a8bced..faf18252e4b3e763eba09349b64214379a9f395d 100644 (file)
@@ -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));
                        }
index d6ca5c76d59806bf4f5d157a717b1f9d8a235c04..a9b7a6c12b2e0b08cd705bf179dbdf8bbe43a008 100644 (file)
@@ -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");
        }
index 5366845519b84a1384439eb4e60229d9bc777981..650a566159713c61cf5b022512fceacae2052195 100644 (file)
@@ -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");
                        }
index e551ba67b25a0f8676b48f404914edc121a35426..b4e7f0e51ad27034e4c5b8dfe8d0dbbc2b9220cd 100644 (file)
@@ -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;
index dc23ff85e0c0c100c1bd2a66f5f4ad67ae7f156e..d5bc4c5cf0af1ed51747ece368cc362dca7281cb 100644 (file)
@@ -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) {
index 4505081ee2208ad09d3ad7b60b8d6fed521203e3..c529646730414aece7cd4a2671a3ac5612055ac1 100644 (file)
@@ -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
index 679281100305aadd9da1fb29f4e049bb89c8c35b..2bfd933944a0d1f8debf28f2a34b02d329ac2643 100644 (file)
@@ -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;
 
index ded81e291894604e7ee90d4cccf12425dbec5175..d5420dae7686f39c991bfa3366365648efd383d5 100644 (file)
@@ -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);
index 0cd5419d9c714d3ccd4e57ff103edac913560564..1cdc5d30210d100898a0f061ceaf068f482d7761 100644 (file)
@@ -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);
        }
index 57fb40bc1321778a08e5345efce15cceb9a28f04..28804bf542a2fcb24b95dc777cd95d7e6be25a96 100644 (file)
@@ -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);
index 656c0fcd9e1d8746b994062af59acdfe0681797b..ae5bac4db37f9d5b807abb80ef8db6b6dd9b223c 100644 (file)
@@ -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);
index 6bacbab1469b1ac3c08531e198eca7eb5d9be3e8..aa63f8f338cdc97c79b1d4d82f19ade769b2fbb0 100644 (file)
@@ -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)) {
index 8bab4ae3cf7a4bdd050c2162484d76c45b7bb13c..3730adc699f7969a4a4261e84dd9947d4e76bfe1 100644 (file)
@@ -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);
        
index 5fe17c88fb1fdfd7cacecd6996cd32380d3df860..644e364f217afb082b838e5d64857091125c258a 100644 (file)
@@ -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) {