]> granicus.if.org Git - php/commitdiff
Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing...
authorDmitry Stogov <dmitry@zend.com>
Wed, 2 Jul 2014 21:02:25 +0000 (01:02 +0400)
committerDmitry Stogov <dmitry@zend.com>
Wed, 2 Jul 2014 21:02:25 +0000 (01:02 +0400)
16 files changed:
Zend/zend.c
Zend/zend_API.c
Zend/zend_alloc.c
Zend/zend_constants.c
Zend/zend_execute_API.c
Zend/zend_globals.h
Zend/zend_objects.c
Zend/zend_vm_execute.h
Zend/zend_vm_execute.skl
Zend/zend_vm_gen.php
ext/opcache/Optimizer/pass1_5.c
ext/opcache/ZendAccelerator.c
ext/opcache/zend_persist.c
ext/soap/soap.c
ext/standard/assert.c
main/SAPI.c

index 68ed5c9fd1934609abda785575c307b88f414d9c..14045914b6404e4886736e11929cdf36c0d7c69a 100644 (file)
@@ -559,7 +559,6 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
        EG(lambda_count) = 0;
        ZVAL_UNDEF(&EG(user_error_handler));
        ZVAL_UNDEF(&EG(user_exception_handler));
-       EG(in_execution) = 0;
        EG(in_autoload) = NULL;
        EG(current_execute_data) = NULL;
        EG(current_module) = NULL;
@@ -880,7 +879,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
        }
        CG(unclean_shutdown) = 1;
        CG(active_class_entry) = NULL;
-       CG(in_compilation) = EG(in_execution) = 0;
+       CG(in_compilation) = 0;
        EG(current_execute_data) = NULL;
        LONGJMP(*EG(bailout), FAILURE);
 }
@@ -1097,7 +1096,12 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
                                error_lineno = zend_get_compiled_lineno(TSRMLS_C);
                        } else if (zend_is_executing(TSRMLS_C)) {
                                error_filename = zend_get_executed_filename(TSRMLS_C);
-                               error_lineno = zend_get_executed_lineno(TSRMLS_C);
+                               if (error_filename[0] == '[') { /* [no active file] */
+                                       error_filename = NULL;
+                                       error_lineno = 0;
+                               } else {
+                                       error_lineno = zend_get_executed_lineno(TSRMLS_C);
+                               }
                        } else {
                                error_filename = NULL;
                                error_lineno = 0;
index 36b615ba1b4611daf3d15df7cde778d394e18df6..6474fd6ad7012ce4b119a55b132acb63b8a8bced 100644 (file)
@@ -1072,7 +1072,7 @@ static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS
 {
        ZVAL_DEREF(pp);
        if (Z_CONSTANT_P(pp)) {
-               zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
+               zend_class_entry **scope = EG(current_execute_data) ? &EG(scope) : &CG(active_class_entry);
 
                if ((*scope)->parent) {
                        zend_class_entry *ce = *scope;
@@ -1136,7 +1136,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
        }
 
        if ((class_type->ce_flags & ZEND_ACC_CONSTANTS_UPDATED) == 0) {
-               zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
+               zend_class_entry **scope = EG(current_execute_data) ? &EG(scope) : &CG(active_class_entry);
                zend_class_entry *old_scope = *scope;
                zval *val;
 
index 1f6b62eb23620f92320b7ddd49f6331ea18a6f65..35a201b21c9e4b8b22952a6443585ba7aea65f4d 100644 (file)
@@ -1761,7 +1761,7 @@ static void zend_mm_safe_error(zend_mm_heap *heap,
                        zend_string *str = zend_get_compiled_filename(TSRMLS_C);
                        error_filename = str ? str->val : NULL;
                        error_lineno = zend_get_compiled_lineno(TSRMLS_C);
-               } else if (EG(in_execution) && EG(current_execute_data)) {
+               } else if (EG(current_execute_data)) {
                        zend_execute_data *ex = EG(current_execute_data);
 
                        while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
index 4930d1fdd423516a014495efd79af8acca464e85..5366845519b84a1384439eb4e60229d9bc777981 100644 (file)
@@ -231,7 +231,7 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len
        zend_constant *c;
        static char haltoff[] = "__COMPILER_HALT_OFFSET__";
 
-       if (!EG(in_execution)) {
+       if (!EG(current_execute_data)) {
                return NULL;
        } else if (name_len == sizeof("__CLASS__")-1 &&
                  !memcmp(name, "__CLASS__", sizeof("__CLASS__")-1)) {
@@ -354,7 +354,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope,
                lcname = do_alloca(class_name_len + 1, use_heap);
                zend_str_tolower_copy(lcname, name, class_name_len);
                if (!scope) {
-                       if (EG(in_execution)) {
+                       if (EG(current_execute_data)) {
                                scope = EG(scope);
                        } else {
                                scope = CG(active_class_entry);
index 7e66b64d987ec1b8d001d2430265d156306a0754..dc23ff85e0c0c100c1bd2a66f5f4ad67ae7f156e 100644 (file)
@@ -150,7 +150,6 @@ void init_executor(TSRMLS_D) /* {{{ */
        EG(function_table) = CG(function_table);
        EG(class_table) = CG(class_table);
 
-       EG(in_execution) = 0;
        EG(in_autoload) = NULL;
        EG(autoload_func) = NULL;
        EG(error_handling) = EH_NORMAL;
@@ -483,7 +482,7 @@ ZEND_API uint zend_get_executed_lineno(TSRMLS_D) /* {{{ */
 
 ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */
 {
-       return EG(in_execution);
+       return EG(current_execute_data) != 0;
 }
 /* }}} */
 
index c3105ec47b67b8722fac64221af442a241cf5c13..679281100305aadd9da1fb29f4e049bb89c8c35b 100644 (file)
@@ -194,7 +194,6 @@ struct _zend_executor_globals {
 
        int ticks_count;
 
-       zend_bool in_execution;
        HashTable *in_autoload;
        zend_function *autoload_func;
        zend_bool full_tables_cleanup;
index 1ef0e1d7e78b3a411337e8af69e6e5045d63fd14..af0070c5fbc8eb3d07b4a664be61ecf2dad0e849 100644 (file)
@@ -77,11 +77,11 @@ ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
                                if (object->ce != EG(scope)) {
                                        zend_class_entry *ce = object->ce;
 
-                                       zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
+                                       zend_error(EG(current_execute_data) ? E_ERROR : E_WARNING,
                                                "Call to private %s::__destruct() from context '%s'%s",
                                                ce->name->val,
                                                EG(scope) ? EG(scope)->name->val : "",
-                                               EG(in_execution) ? "" : " during shutdown ignored");
+                                               EG(current_execute_data) ? "" : " during shutdown ignored");
                                        return;
                                }
                        } else {
@@ -90,11 +90,11 @@ ZEND_API void zend_objects_destroy_object(zend_object *object TSRMLS_DC)
                                if (!zend_check_protected(zend_get_function_root_class(destructor), EG(scope))) {
                                        zend_class_entry *ce = object->ce;
 
-                                       zend_error(EG(in_execution) ? E_ERROR : E_WARNING,
+                                       zend_error(EG(current_execute_data) ? E_ERROR : E_WARNING,
                                                "Call to protected %s::__destruct() from context '%s'%s",
                                                ce->name->val,
                                                EG(scope) ? EG(scope)->name->val : "",
-                                               EG(in_execution) ? "" : " during shutdown ignored");
+                                               EG(current_execute_data) ? "" : " during shutdown ignored");
                                        return;
                                }
                        }
index fb41fd41a3f34f5024f80767692a7694a83d251c..57fb40bc1321778a08e5345efce15cceb9a28f04 100644 (file)
@@ -337,13 +337,9 @@ static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* o
 ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC)
 {
        DCL_OPLINE
-       zend_bool original_in_execution;
 
 
 
-       original_in_execution = EG(in_execution);
-       EG(in_execution) = 1;
-
        LOAD_REGS();
        LOAD_OPLINE();
 
@@ -358,7 +354,6 @@ ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC)
                if ((ret = OPLINE->handler(execute_data TSRMLS_CC)) > 0) {
                        switch (ret) {
                                case 1:
-                                       EG(in_execution) = original_in_execution;
                                        return;
                                case 2:
                                case 3:
index 41a834de958b714ffda69d4d6563d3d1869e97bc..656c0fcd9e1d8746b994062af59acdfe0681797b 100644 (file)
@@ -3,15 +3,11 @@
 ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *execute_data TSRMLS_DC)
 {
        DCL_OPLINE
-       zend_bool original_in_execution;
 
        {%HELPER_VARS%}
 
        {%INTERNAL_LABELS%}
 
-       original_in_execution = EG(in_execution);
-       EG(in_execution) = 1;
-
        LOAD_REGS();
        LOAD_OPLINE();
 
index bdc6cc79b83185c897a0acc2364de2289dac80b9..b0a642084dcf5bb96f942a78fd737ccade30122e 100644 (file)
@@ -941,7 +941,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
                                                        out($f,"#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()\n");
                                                        out($f,"#define LOAD_REGS()\n");
                                                        out($f,"#define ZEND_VM_CONTINUE() goto zend_vm_continue\n");
-                                                       out($f,"#define ZEND_VM_RETURN()   EG(in_execution) = original_in_execution; return\n");
+                                                       out($f,"#define ZEND_VM_RETURN()   return\n");
                                                        out($f,"#define ZEND_VM_ENTER()    execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
                                                        out($f,"#define ZEND_VM_LEAVE()    ZEND_VM_CONTINUE()\n");
                                                        out($f,"#define ZEND_VM_DISPATCH(opcode, opline) dispatch_handler = zend_vm_get_opcode_handler(opcode, opline); goto zend_vm_dispatch;\n\n");
@@ -973,7 +973,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
                                                        }
                                                        out($f,"#define LOAD_REGS()\n");
                                                        out($f,"#define ZEND_VM_CONTINUE() goto *(void**)(OPLINE->handler)\n");
-                                                       out($f,"#define ZEND_VM_RETURN()   EG(in_execution) = original_in_execution; return\n");
+                                                       out($f,"#define ZEND_VM_RETURN()   return\n");
                                                        out($f,"#define ZEND_VM_ENTER()    execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_CONTINUE()\n");
                                                        out($f,"#define ZEND_VM_LEAVE()    ZEND_VM_CONTINUE()\n");
                                                        out($f,"#define ZEND_VM_DISPATCH(opcode, opline) goto *(void**)(zend_vm_get_opcode_handler(opcode, opline));\n\n");
@@ -1043,7 +1043,6 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name,
                                          // Executor is defined as a set of functions
                                                out($f, $m[1]."switch (ret) {\n" . 
                                                        $m[1]."\tcase 1:\n" . 
-                                                       $m[1]."\t\tEG(in_execution) = original_in_execution;\n".
                                                        $m[1]."\t\treturn;\n".
                                                        $m[1]."\tcase 2:\n" . 
                                                        $m[1]."\tcase 3:\n" . 
index 62cadc571072e0a6ae369b0b4e509de8fa7bd7f1..91b78ec6f01d92b4f892f3f347fd91fcf7a4967d 100644 (file)
@@ -219,12 +219,10 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("__COMPILER_HALT_OFFSET__") - 1 &&
                                memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) {
                                /* substitute __COMPILER_HALT_OFFSET__ constant */
-                               zend_bool orig_in_execution = EG(in_execution);
                                zend_execute_data *orig_execute_data = EG(current_execute_data);
                                zend_execute_data fake_execute_data;
                                zval *offset;
 
-                               EG(in_execution) = 1;
                                memset(&fake_execute_data, 0, sizeof(zend_execute_data));
                                fake_execute_data.func = (zend_function*)op_array;
                                EG(current_execute_data) = &fake_execute_data;
@@ -236,7 +234,6 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                        replace_tmp_by_const(op_array, opline, tv, offset TSRMLS_CC);
                                }
                                EG(current_execute_data) = orig_execute_data;
-                               EG(in_execution) = orig_in_execution;
                                break;
                        }
 
index 112d1576c661965957a3d68913cbe2884f794edc..e84de1a34c4c31ab0299afa59e81fddf076ec661 100644 (file)
@@ -995,7 +995,7 @@ char *accel_make_persistent_key_ex(zend_file_handle *file_handle, int path_lengt
            since fopen_wrappers from version 4.0.7 use current script's path
            in include path too.
         */
-        if (EG(in_execution) &&
+        if (EG(current_execute_data) &&
             (parent_script = zend_get_executed_filename(TSRMLS_C)) != NULL &&
                parent_script[0] != '[') {
 
index 304c8c2b91b326e30fda856ba97a045da4c31f7f..e47cfda894229326a3dcaca63cc1cfbd0e9bf06c 100644 (file)
@@ -297,7 +297,6 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
        op_array->refcount = NULL;
 
        if (main_persistent_script) {
-               zend_bool orig_in_execution = EG(in_execution);
                zend_execute_data *orig_execute_data = EG(current_execute_data);
                zend_execute_data fake_execute_data;
                zval *offset;
@@ -305,7 +304,6 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
 #if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO
                main_persistent_script->early_binding = -1;
 #endif
-               EG(in_execution) = 1;
                memset(&fake_execute_data, 0, sizeof(fake_execute_data));
                fake_execute_data.func = (zend_function*)op_array;
                EG(current_execute_data) = &fake_execute_data;
@@ -313,7 +311,6 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
                        main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset);
                }
                EG(current_execute_data) = orig_execute_data;
-               EG(in_execution) = orig_in_execution;
        }
 
        if (op_array->static_variables) {
index fe97793afeee19d7ce50898f90145181bffbd756..d98d1fc4941721266fdb2dd3a434584160fc509e 100644 (file)
@@ -92,7 +92,6 @@ static void soap_error_handler(int error_num, const char *error_filename, const
        zend_object* _old_error_object = Z_OBJ(SOAP_GLOBAL(error_object));\
        int _old_soap_version = SOAP_GLOBAL(soap_version);\
        zend_bool _old_in_compilation = CG(in_compilation); \
-       zend_bool _old_in_execution = EG(in_execution); \
        zend_execute_data *_old_current_execute_data = EG(current_execute_data); \
        zval *_old_stack_top = EG(argument_stack)->top; \
        int _bailout = 0;\
@@ -104,7 +103,6 @@ static void soap_error_handler(int error_num, const char *error_filename, const
 #define SOAP_CLIENT_END_CODE() \
        } zend_catch {\
                CG(in_compilation) = _old_in_compilation; \
-               EG(in_execution) = _old_in_execution; \
                EG(current_execute_data) = _old_current_execute_data; \
                if (EG(exception) == NULL || \
                    !instanceof_function(zend_get_class_entry(EG(exception) TSRMLS_CC), soap_fault_class_entry TSRMLS_CC)) {\
@@ -2131,14 +2129,13 @@ static void soap_server_fault(char* code, char* string, char *actor, zval* detai
 
 static void soap_error_handler(int error_num, const char *error_filename, const uint error_lineno, const char *format, va_list args)
 {
-       zend_bool _old_in_compilation, _old_in_execution;
+       zend_bool _old_in_compilation;
        zend_execute_data *_old_current_execute_data;
        int _old_http_response_code;
        char *_old_http_status_line;
        TSRMLS_FETCH();
 
        _old_in_compilation = CG(in_compilation);
-       _old_in_execution = EG(in_execution);
        _old_current_execute_data = EG(current_execute_data);
        _old_http_response_code = SG(sapi_headers).http_response_code;
        _old_http_status_line = SG(sapi_headers).http_status_line;
@@ -2204,7 +2201,6 @@ static void soap_error_handler(int error_num, const char *error_filename, const
                                call_old_error_handler(error_num, error_filename, error_lineno, format, args);
                        } zend_catch {
                                CG(in_compilation) = _old_in_compilation;
-                               EG(in_execution) = _old_in_execution;
                                EG(current_execute_data) = _old_current_execute_data;
                                if (SG(sapi_headers).http_status_line) {
                                        efree(SG(sapi_headers).http_status_line);
@@ -2287,7 +2283,6 @@ static void soap_error_handler(int error_num, const char *error_filename, const
                        call_old_error_handler(error_num, error_filename, error_lineno, format, args);
                } zend_catch {
                        CG(in_compilation) = _old_in_compilation;
-                       EG(in_execution) = _old_in_execution;
                        EG(current_execute_data) = _old_current_execute_data;
                        if (SG(sapi_headers).http_status_line) {
                                efree(SG(sapi_headers).http_status_line);
index 3ec73611978eb4559a1e622f10b478be04336f35..e64e2e1ecb673ad6a3cfe7e5eb9b0ae35ef0db1b 100644 (file)
@@ -53,7 +53,7 @@ enum {
 
 static PHP_INI_MH(OnChangeCallback) /* {{{ */
 {
-       if (EG(in_execution)) {
+       if (EG(current_execute_data)) {
                if (Z_TYPE(ASSERTG(callback)) != IS_UNDEF) {
                        zval_ptr_dtor(&ASSERTG(callback));
                        ZVAL_UNDEF(&ASSERTG(callback));
index e587f7aaf728df0f5bf5ebe1d2369879b985774e..229396dd79b633619ca688a42eb75048c2453aa3 100644 (file)
@@ -947,7 +947,7 @@ SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries TSRMLS_DC)
 
 SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
 {
-       if (SG(sapi_started) && EG(in_execution)) {
+       if (SG(sapi_started) && EG(current_execute_data)) {
                return FAILURE;
        }
        return zend_hash_str_add_mem(&SG(known_post_content_types),
@@ -957,7 +957,7 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
 
 SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
 {
-       if (SG(sapi_started) && EG(in_execution)) {
+       if (SG(sapi_started) && EG(current_execute_data)) {
                return;
        }
        zend_hash_str_del(&SG(known_post_content_types), post_entry->content_type,
@@ -967,7 +967,7 @@ SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC)
 
 SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC)
 {
-       if (SG(sapi_started) && EG(in_execution)) {
+       if (SG(sapi_started) && EG(current_execute_data)) {
                return FAILURE;
        }
        sapi_module.default_post_reader = default_post_reader;
@@ -977,7 +977,7 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRML
 
 SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC)
 {
-       if (SG(sapi_started) && EG(in_execution)) {
+       if (SG(sapi_started) && EG(current_execute_data)) {
                return FAILURE;
        }
        sapi_module.treat_data = treat_data;
@@ -986,7 +986,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva
 
 SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC)
 {
-       if (SG(sapi_started) && EG(in_execution)) {
+       if (SG(sapi_started) && EG(current_execute_data)) {
                return FAILURE;
        }
        sapi_module.input_filter = input_filter;