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;
}
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);
}
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;
{
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;
}
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;
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))) {
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)) {
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);
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;
ZEND_API zend_bool zend_is_executing(TSRMLS_D) /* {{{ */
{
- return EG(in_execution);
+ return EG(current_execute_data) != 0;
}
/* }}} */
int ticks_count;
- zend_bool in_execution;
HashTable *in_autoload;
zend_function *autoload_func;
zend_bool full_tables_cleanup;
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 {
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;
}
}
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();
if ((ret = OPLINE->handler(execute_data TSRMLS_CC)) > 0) {
switch (ret) {
case 1:
- EG(in_execution) = original_in_execution;
return;
case 2:
case 3:
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();
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");
}
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");
// 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" .
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;
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;
}
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] != '[') {
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;
#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;
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) {
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;\
#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)) {\
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;
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);
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);
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));
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),
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,
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;
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;
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;