version 1.1.1.1, 2012/02/21 23:47:52
|
version 1.1.1.5, 2014/06/15 20:04:03
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Zend Engine | |
| Zend Engine | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) | | | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 2.00 of the Zend license, | |
| This source file is subject to version 2.00 of the Zend license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 29
|
Line 29
|
#include "zend_builtin_functions.h" |
#include "zend_builtin_functions.h" |
#include "zend_ini.h" |
#include "zend_ini.h" |
#include "zend_vm.h" |
#include "zend_vm.h" |
|
#include "zend_dtrace.h" |
|
|
#ifdef ZTS |
#ifdef ZTS |
# define GLOBAL_FUNCTION_TABLE global_function_table |
# define GLOBAL_FUNCTION_TABLE global_function_table |
Line 42
|
Line 43
|
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants) |
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants) |
#endif |
#endif |
|
|
#if defined(ZEND_WIN32) && ZEND_DEBUG |
|
BOOL WINAPI IsDebuggerPresent(VOID); |
|
#endif |
|
|
|
/* true multithread-shared globals */ |
/* true multithread-shared globals */ |
ZEND_API zend_class_entry *zend_standard_class_def = NULL; |
ZEND_API zend_class_entry *zend_standard_class_def = NULL; |
ZEND_API int (*zend_printf)(const char *format, ...); |
ZEND_API int (*zend_printf)(const char *format, ...); |
Line 60 int (*zend_vspprintf)(char **pbuf, size_t max_len, con
|
Line 57 int (*zend_vspprintf)(char **pbuf, size_t max_len, con
|
ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); |
ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC); |
ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); |
ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC); |
|
|
#if SUHOSIN_PATCH |
|
ZEND_API void (*zend_suhosin_log)(int loglevel, char *fmt, ...); |
|
#endif |
|
|
|
void (*zend_on_timeout)(int seconds TSRMLS_DC); |
void (*zend_on_timeout)(int seconds TSRMLS_DC); |
|
|
static void (*zend_message_dispatcher_p)(long message, void *data TSRMLS_DC); | static void (*zend_message_dispatcher_p)(long message, const void *data TSRMLS_DC); |
static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents); |
static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents); |
|
|
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ |
static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ |
Line 92 static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
|
Line 85 static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
#if SUHOSIN_PATCH | static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */ |
static ZEND_INI_MH(OnUpdateSuhosin_log_syslog) | |
{ |
{ |
if (!new_value) { | if (!CG(multibyte)) { |
SPG(log_syslog) = S_ALL & ~S_SQL | S_MEMORY; | return FAILURE; |
} else { | |
SPG(log_syslog) = atoi(new_value) | S_MEMORY; | |
} |
} |
return SUCCESS; | if (!zend_multibyte_get_functions(TSRMLS_C)) { |
} | return SUCCESS; |
static ZEND_INI_MH(OnUpdateSuhosin_log_syslog_facility) | |
{ | |
if (!new_value) { | |
SPG(log_syslog_facility) = LOG_USER; | |
} else { | |
SPG(log_syslog_facility) = atoi(new_value); | |
} |
} |
return SUCCESS; | return zend_multibyte_set_script_encoding_by_string(new_value, new_value_length TSRMLS_CC); |
} |
} |
static ZEND_INI_MH(OnUpdateSuhosin_log_syslog_priority) | /* }}} */ |
{ | |
if (!new_value) { | |
SPG(log_syslog_priority) = LOG_ALERT; | |
} else { | |
SPG(log_syslog_priority) = atoi(new_value); | |
} | |
return SUCCESS; | |
} | |
static ZEND_INI_MH(OnUpdateSuhosin_log_sapi) | |
{ | |
if (!new_value) { | |
SPG(log_sapi) = S_ALL & ~S_SQL; | |
} else { | |
SPG(log_sapi) = atoi(new_value); | |
} | |
return SUCCESS; | |
} | |
static ZEND_INI_MH(OnUpdateSuhosin_log_script) | |
{ | |
if (!new_value) { | |
SPG(log_script) = S_ALL & ~S_MEMORY; | |
} else { | |
SPG(log_script) = atoi(new_value) & (~S_MEMORY) & (~S_INTERNAL); | |
} | |
return SUCCESS; | |
} | |
static ZEND_INI_MH(OnUpdateSuhosin_log_scriptname) | |
{ | |
if (SPG(log_scriptname)) { | |
pefree(SPG(log_scriptname),1); | |
} | |
SPG(log_scriptname) = NULL; | |
if (new_value) { | |
SPG(log_scriptname) = pestrdup(new_value,1); | |
} | |
return SUCCESS; | |
} | |
static ZEND_INI_MH(OnUpdateSuhosin_log_phpscript) | |
{ | |
if (!new_value) { | |
SPG(log_phpscript) = S_ALL & ~S_MEMORY; | |
} else { | |
SPG(log_phpscript) = atoi(new_value) & (~S_MEMORY) & (~S_INTERNAL); | |
} | |
return SUCCESS; | |
} | |
#endif | |
|
|
|
|
ZEND_INI_BEGIN() |
ZEND_INI_BEGIN() |
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting) |
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting) |
STD_ZEND_INI_BOOLEAN("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, gc_enabled, zend_gc_globals, gc_globals) |
STD_ZEND_INI_BOOLEAN("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, gc_enabled, zend_gc_globals, gc_globals) |
#ifdef ZEND_MULTIBYTE | STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte, zend_compiler_globals, compiler_globals) |
STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals) | ZEND_INI_ENTRY("zend.script_encoding", NULL, ZEND_INI_ALL, OnUpdateScriptEncoding) |
| STD_ZEND_INI_BOOLEAN("zend.detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals) |
| #ifdef ZEND_SIGNALS |
| STD_ZEND_INI_BOOLEAN("zend.signal_check", "0", ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals) |
#endif |
#endif |
ZEND_INI_END() |
ZEND_INI_END() |
|
|
Line 186 ZEND_API zval zval_used_for_init; /* True global varia
|
Line 127 ZEND_API zval zval_used_for_init; /* True global varia
|
/* version information */ |
/* version information */ |
static char *zend_version_info; |
static char *zend_version_info; |
static uint zend_version_info_length; |
static uint zend_version_info_length; |
#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2012 Zend Technologies\n" | #define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2014 Zend Technologies\n" |
#define PRINT_ZVAL_INDENT 4 |
#define PRINT_ZVAL_INDENT 4 |
|
|
static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) /* {{{ */ |
static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) /* {{{ */ |
Line 212 static void print_hash(zend_write_func_t write_func, H
|
Line 153 static void print_hash(zend_write_func_t write_func, H
|
switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { |
switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) { |
case HASH_KEY_IS_STRING: |
case HASH_KEY_IS_STRING: |
if (is_object) { |
if (is_object) { |
char *prop_name, *class_name; | const char *prop_name, *class_name; |
int mangled = zend_unmangle_property_name(string_key, str_len - 1, &class_name, &prop_name); |
int mangled = zend_unmangle_property_name(string_key, str_len - 1, &class_name, &prop_name); |
|
|
ZEND_PUTS_EX(prop_name); |
ZEND_PUTS_EX(prop_name); |
Line 302 ZEND_API void zend_make_printable_zval(zval *expr, zva
|
Line 243 ZEND_API void zend_make_printable_zval(zval *expr, zva
|
break; |
break; |
case IS_RESOURCE: |
case IS_RESOURCE: |
Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG); |
Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG); |
Z_STRLEN_P(expr_copy) = sprintf(Z_STRVAL_P(expr_copy), "Resource id #%ld", Z_LVAL_P(expr)); | Z_STRLEN_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr)); |
break; |
break; |
case IS_ARRAY: |
case IS_ARRAY: |
|
zend_error(E_NOTICE, "Array to string conversion"); |
Z_STRLEN_P(expr_copy) = sizeof("Array") - 1; |
Z_STRLEN_P(expr_copy) = sizeof("Array") - 1; |
Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy)); |
Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy)); |
break; |
break; |
Line 312 ZEND_API void zend_make_printable_zval(zval *expr, zva
|
Line 254 ZEND_API void zend_make_printable_zval(zval *expr, zva
|
{ |
{ |
TSRMLS_FETCH(); |
TSRMLS_FETCH(); |
|
|
if (Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, cast_object)(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { | if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { |
break; |
break; |
} |
} |
/* Standard PHP objects */ | if (Z_OBJ_HANDLER_P(expr, cast_object)) { |
if (Z_OBJ_HT_P(expr) == &std_object_handlers || !Z_OBJ_HANDLER_P(expr, cast_object)) { | zval *val; |
if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { | |
| ALLOC_ZVAL(val); |
| INIT_PZVAL_COPY(val, expr); |
| zval_copy_ctor(val); |
| if (Z_OBJ_HANDLER_P(expr, cast_object)(val, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) { |
| zval_ptr_dtor(&val); |
break; |
break; |
} |
} |
|
zval_ptr_dtor(&val); |
} |
} |
if (!Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, get)) { |
if (!Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, get)) { |
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); |
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC); |
Line 404 ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS
|
Line 352 ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS
|
case IS_OBJECT: |
case IS_OBJECT: |
{ |
{ |
HashTable *properties = NULL; |
HashTable *properties = NULL; |
char *class_name = NULL; | const char *class_name = NULL; |
zend_uint clen; |
zend_uint clen; |
|
|
if (Z_OBJ_HANDLER_P(expr, get_class_name)) { |
if (Z_OBJ_HANDLER_P(expr, get_class_name)) { |
Line 416 ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS
|
Line 364 ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS
|
zend_printf("%s Object (", "Unknown Class"); |
zend_printf("%s Object (", "Unknown Class"); |
} |
} |
if (class_name) { |
if (class_name) { |
efree(class_name); | efree((char*)class_name); |
} |
} |
if (Z_OBJ_HANDLER_P(expr, get_properties)) { |
if (Z_OBJ_HANDLER_P(expr, get_properties)) { |
properties = Z_OBJPROP_P(expr); |
properties = Z_OBJPROP_P(expr); |
Line 462 ZEND_API void zend_print_zval_r_ex(zend_write_func_t w
|
Line 410 ZEND_API void zend_print_zval_r_ex(zend_write_func_t w
|
case IS_OBJECT: |
case IS_OBJECT: |
{ |
{ |
HashTable *properties; |
HashTable *properties; |
char *class_name = NULL; | const char *class_name = NULL; |
zend_uint clen; |
zend_uint clen; |
int is_temp; |
int is_temp; |
|
|
Line 476 ZEND_API void zend_print_zval_r_ex(zend_write_func_t w
|
Line 424 ZEND_API void zend_print_zval_r_ex(zend_write_func_t w
|
} |
} |
ZEND_PUTS_EX(" Object\n"); |
ZEND_PUTS_EX(" Object\n"); |
if (class_name) { |
if (class_name) { |
efree(class_name); | efree((char*)class_name); |
} |
} |
if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) { |
if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) { |
break; |
break; |
Line 513 static FILE *zend_fopen_wrapper(const char *filename,
|
Line 461 static FILE *zend_fopen_wrapper(const char *filename,
|
#ifdef ZTS |
#ifdef ZTS |
static zend_bool asp_tags_default = 0; |
static zend_bool asp_tags_default = 0; |
static zend_bool short_tags_default = 1; |
static zend_bool short_tags_default = 1; |
static zend_bool ct_pass_ref_default = 1; |
|
static zend_uint compiler_options_default = ZEND_COMPILE_DEFAULT; |
static zend_uint compiler_options_default = ZEND_COMPILE_DEFAULT; |
#else |
#else |
# define asp_tags_default 0 |
# define asp_tags_default 0 |
# define short_tags_default 1 |
# define short_tags_default 1 |
# define ct_pass_ref_default 1 |
|
# define compiler_options_default ZEND_COMPILE_DEFAULT |
# define compiler_options_default ZEND_COMPILE_DEFAULT |
#endif |
#endif |
|
|
Line 527 static void zend_set_default_compile_time_values(TSRML
|
Line 473 static void zend_set_default_compile_time_values(TSRML
|
/* default compile-time values */ |
/* default compile-time values */ |
CG(asp_tags) = asp_tags_default; |
CG(asp_tags) = asp_tags_default; |
CG(short_tags) = short_tags_default; |
CG(short_tags) = short_tags_default; |
CG(allow_call_time_pass_reference) = ct_pass_ref_default; |
|
CG(compiler_options) = compiler_options_default; |
CG(compiler_options) = compiler_options_default; |
} |
} |
/* }}} */ |
/* }}} */ |
Line 536 static void zend_init_exception_op(TSRMLS_D) /* {{{ */
|
Line 481 static void zend_init_exception_op(TSRMLS_D) /* {{{ */
|
{ |
{ |
memset(EG(exception_op), 0, sizeof(EG(exception_op))); |
memset(EG(exception_op), 0, sizeof(EG(exception_op))); |
EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION; |
EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION; |
EG(exception_op)[0].op1.op_type = IS_UNUSED; | EG(exception_op)[0].op1_type = IS_UNUSED; |
EG(exception_op)[0].op2.op_type = IS_UNUSED; | EG(exception_op)[0].op2_type = IS_UNUSED; |
EG(exception_op)[0].result.op_type = IS_UNUSED; | EG(exception_op)[0].result_type = IS_UNUSED; |
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)); |
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)); |
EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION; |
EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION; |
EG(exception_op)[1].op1.op_type = IS_UNUSED; | EG(exception_op)[1].op1_type = IS_UNUSED; |
EG(exception_op)[1].op2.op_type = IS_UNUSED; | EG(exception_op)[1].op2_type = IS_UNUSED; |
EG(exception_op)[1].result.op_type = IS_UNUSED; | EG(exception_op)[1].result_type = IS_UNUSED; |
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1); |
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1); |
EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION; |
EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION; |
EG(exception_op)[2].op1.op_type = IS_UNUSED; | EG(exception_op)[2].op1_type = IS_UNUSED; |
EG(exception_op)[2].op2.op_type = IS_UNUSED; | EG(exception_op)[2].op2_type = IS_UNUSED; |
EG(exception_op)[2].result.op_type = IS_UNUSED; | EG(exception_op)[2].result_type = IS_UNUSED; |
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2); |
ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2); |
} |
} |
/* }}} */ |
/* }}} */ |
Line 579 static void compiler_globals_ctor(zend_compiler_global
|
Line 524 static void compiler_globals_ctor(zend_compiler_global
|
|
|
compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table); |
compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table); |
if (compiler_globals->last_static_member) { |
if (compiler_globals->last_static_member) { |
compiler_globals->static_members = (HashTable**)calloc(compiler_globals->last_static_member, sizeof(HashTable*)); | compiler_globals->static_members_table = calloc(compiler_globals->last_static_member, sizeof(zval**)); |
} else { |
} else { |
compiler_globals->static_members = NULL; | compiler_globals->static_members_table = NULL; |
} |
} |
|
compiler_globals->script_encoding_list = NULL; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 600 static void compiler_globals_dtor(zend_compiler_global
|
Line 546 static void compiler_globals_dtor(zend_compiler_global
|
zend_hash_destroy(compiler_globals->auto_globals); |
zend_hash_destroy(compiler_globals->auto_globals); |
free(compiler_globals->auto_globals); |
free(compiler_globals->auto_globals); |
} |
} |
if (compiler_globals->static_members) { | if (compiler_globals->static_members_table) { |
free(compiler_globals->static_members); | free(compiler_globals->static_members_table); |
} |
} |
|
if (compiler_globals->script_encoding_list) { |
|
pefree(compiler_globals->script_encoding_list, 1); |
|
} |
compiler_globals->last_static_member = 0; |
compiler_globals->last_static_member = 0; |
} |
} |
/* }}} */ |
/* }}} */ |
Line 621 static void executor_globals_ctor(zend_executor_global
|
Line 570 static void executor_globals_ctor(zend_executor_global
|
EG(current_execute_data) = NULL; |
EG(current_execute_data) = NULL; |
EG(current_module) = NULL; |
EG(current_module) = NULL; |
EG(exit_status) = 0; |
EG(exit_status) = 0; |
EG(saved_fpu_cw) = NULL; | #if XPFPA_HAVE_CW |
| EG(saved_fpu_cw) = 0; |
| #endif |
| EG(saved_fpu_cw_ptr) = NULL; |
EG(active) = 0; |
EG(active) = 0; |
} |
} |
/* }}} */ |
/* }}} */ |
Line 667 static void php_scanner_globals_ctor(zend_php_scanner_
|
Line 619 static void php_scanner_globals_ctor(zend_php_scanner_
|
|
|
void zend_init_opcodes_handlers(void); |
void zend_init_opcodes_handlers(void); |
|
|
|
static zend_bool php_auto_globals_create_globals(const char *name, uint name_len TSRMLS_DC) /* {{{ */ |
|
{ |
|
zval *globals; |
|
|
|
ALLOC_ZVAL(globals); |
|
Z_SET_REFCOUNT_P(globals, 1); |
|
Z_SET_ISREF_P(globals); |
|
Z_TYPE_P(globals) = IS_ARRAY; |
|
Z_ARRVAL_P(globals) = &EG(symbol_table); |
|
zend_hash_update(&EG(symbol_table), name, name_len + 1, &globals, sizeof(zval *), NULL); |
|
return 0; |
|
} |
|
/* }}} */ |
|
|
int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC) /* {{{ */ |
int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC) /* {{{ */ |
{ |
{ |
#ifdef ZTS |
#ifdef ZTS |
Line 699 int zend_startup(zend_utility_functions *utility_funct
|
Line 665 int zend_startup(zend_utility_functions *utility_funct
|
} |
} |
zend_stream_open_function = utility_functions->stream_open_function; |
zend_stream_open_function = utility_functions->stream_open_function; |
zend_message_dispatcher_p = utility_functions->message_handler; |
zend_message_dispatcher_p = utility_functions->message_handler; |
|
#ifndef ZEND_SIGNALS |
zend_block_interruptions = utility_functions->block_interruptions; |
zend_block_interruptions = utility_functions->block_interruptions; |
zend_unblock_interruptions = utility_functions->unblock_interruptions; |
zend_unblock_interruptions = utility_functions->unblock_interruptions; |
|
#endif |
zend_get_configuration_directive_p = utility_functions->get_configuration_directive; |
zend_get_configuration_directive_p = utility_functions->get_configuration_directive; |
zend_ticks_function = utility_functions->ticks_function; |
zend_ticks_function = utility_functions->ticks_function; |
zend_on_timeout = utility_functions->on_timeout; |
zend_on_timeout = utility_functions->on_timeout; |
Line 708 int zend_startup(zend_utility_functions *utility_funct
|
Line 676 int zend_startup(zend_utility_functions *utility_funct
|
zend_getenv = utility_functions->getenv_function; |
zend_getenv = utility_functions->getenv_function; |
zend_resolve_path = utility_functions->resolve_path_function; |
zend_resolve_path = utility_functions->resolve_path_function; |
|
|
|
#if HAVE_DTRACE |
|
/* build with dtrace support */ |
|
zend_compile_file = dtrace_compile_file; |
|
zend_execute = dtrace_execute; |
|
zend_execute_internal = dtrace_execute_internal; |
|
#else |
zend_compile_file = compile_file; |
zend_compile_file = compile_file; |
zend_compile_string = compile_string; |
|
zend_execute = execute; |
zend_execute = execute; |
zend_execute_internal = NULL; |
zend_execute_internal = NULL; |
|
#endif /* HAVE_SYS_SDT_H */ |
|
zend_compile_string = compile_string; |
zend_throw_exception_hook = NULL; |
zend_throw_exception_hook = NULL; |
|
|
zend_init_opcodes_handlers(); |
zend_init_opcodes_handlers(); |
Line 727 int zend_startup(zend_utility_functions *utility_funct
|
Line 702 int zend_startup(zend_utility_functions *utility_funct
|
|
|
zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); |
zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); |
zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0); |
zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0); |
zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, (dtor_func_t) zend_auto_global_dtor, 1, 0); | zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, NULL, 1, 0); |
zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); |
zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0); |
|
|
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0); |
zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0); |
Line 765 int zend_startup(zend_utility_functions *utility_funct
|
Line 740 int zend_startup(zend_utility_functions *utility_funct
|
EG(user_exception_handler) = NULL; |
EG(user_exception_handler) = NULL; |
#endif |
#endif |
|
|
|
zend_interned_strings_init(TSRMLS_C); |
zend_startup_builtin_functions(TSRMLS_C); |
zend_startup_builtin_functions(TSRMLS_C); |
zend_register_standard_constants(TSRMLS_C); |
zend_register_standard_constants(TSRMLS_C); |
zend_register_auto_global("GLOBALS", sizeof("GLOBALS") - 1, NULL TSRMLS_CC); | zend_register_auto_global("GLOBALS", sizeof("GLOBALS") - 1, 1, php_auto_globals_create_globals TSRMLS_CC); |
|
|
#ifndef ZTS |
#ifndef ZTS |
zend_init_rsrc_plist(TSRMLS_C); |
zend_init_rsrc_plist(TSRMLS_C); |
Line 798 void zend_register_standard_ini_entries(TSRMLS_D) /* {
|
Line 774 void zend_register_standard_ini_entries(TSRMLS_D) /* {
|
void zend_post_startup(TSRMLS_D) /* {{{ */ |
void zend_post_startup(TSRMLS_D) /* {{{ */ |
{ |
{ |
#ifdef ZTS |
#ifdef ZTS |
|
zend_encoding **script_encoding_list; |
|
|
zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id); |
zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id); |
zend_executor_globals *executor_globals = ts_resource(executor_globals_id); |
zend_executor_globals *executor_globals = ts_resource(executor_globals_id); |
|
|
Line 807 void zend_post_startup(TSRMLS_D) /* {{{ */
|
Line 785 void zend_post_startup(TSRMLS_D) /* {{{ */
|
|
|
asp_tags_default = CG(asp_tags); |
asp_tags_default = CG(asp_tags); |
short_tags_default = CG(short_tags); |
short_tags_default = CG(short_tags); |
ct_pass_ref_default = CG(allow_call_time_pass_reference); |
|
compiler_options_default = CG(compiler_options); |
compiler_options_default = CG(compiler_options); |
|
|
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); |
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); |
free(compiler_globals->function_table); |
free(compiler_globals->function_table); |
free(compiler_globals->class_table); |
free(compiler_globals->class_table); |
compiler_globals_ctor(compiler_globals, tsrm_ls); | if ((script_encoding_list = (zend_encoding **)compiler_globals->script_encoding_list)) { |
| compiler_globals_ctor(compiler_globals, tsrm_ls); |
| compiler_globals->script_encoding_list = (const zend_encoding **)script_encoding_list; |
| } else { |
| compiler_globals_ctor(compiler_globals, tsrm_ls); |
| } |
free(EG(zend_constants)); |
free(EG(zend_constants)); |
executor_globals_ctor(executor_globals, tsrm_ls); |
executor_globals_ctor(executor_globals, tsrm_ls); |
global_persistent_list = &EG(persistent_list); |
global_persistent_list = &EG(persistent_list); |
Line 824 void zend_post_startup(TSRMLS_D) /* {{{ */
|
Line 806 void zend_post_startup(TSRMLS_D) /* {{{ */
|
|
|
void zend_shutdown(TSRMLS_D) /* {{{ */ |
void zend_shutdown(TSRMLS_D) /* {{{ */ |
{ |
{ |
|
#ifdef ZEND_SIGNALS |
|
zend_signal_shutdown(TSRMLS_C); |
|
#endif |
#ifdef ZEND_WIN32 |
#ifdef ZEND_WIN32 |
zend_shutdown_timeout_thread(); |
zend_shutdown_timeout_thread(); |
#endif |
#endif |
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); |
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); |
zend_hash_graceful_reverse_destroy(&module_registry); | zend_destroy_modules(); |
|
|
zend_hash_destroy(GLOBAL_FUNCTION_TABLE); |
zend_hash_destroy(GLOBAL_FUNCTION_TABLE); |
zend_hash_destroy(GLOBAL_CLASS_TABLE); |
zend_hash_destroy(GLOBAL_CLASS_TABLE); |
Line 853 void zend_shutdown(TSRMLS_D) /* {{{ */
|
Line 838 void zend_shutdown(TSRMLS_D) /* {{{ */
|
GLOBAL_CONSTANTS_TABLE = NULL; |
GLOBAL_CONSTANTS_TABLE = NULL; |
#endif |
#endif |
zend_destroy_rsrc_list_dtors(); |
zend_destroy_rsrc_list_dtors(); |
|
|
|
zend_interned_strings_dtor(TSRMLS_C); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 925 void zend_activate(TSRMLS_D) /* {{{ */
|
Line 912 void zend_activate(TSRMLS_D) /* {{{ */
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
void zend_activate_modules(TSRMLS_D) /* {{{ */ |
|
{ |
|
zend_hash_apply(&module_registry, (apply_func_t) module_registry_request_startup TSRMLS_CC); |
|
} |
|
/* }}} */ |
|
|
|
void zend_deactivate_modules(TSRMLS_D) /* {{{ */ |
|
{ |
|
EG(opline_ptr) = NULL; /* we're no longer executing anything */ |
|
|
|
zend_try { |
|
zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_cleanup TSRMLS_CC); |
|
} zend_end_try(); |
|
} |
|
/* }}} */ |
|
|
|
void zend_call_destructors(TSRMLS_D) /* {{{ */ |
void zend_call_destructors(TSRMLS_D) /* {{{ */ |
{ |
{ |
zend_try { |
zend_try { |
Line 994 void zend_deactivate(TSRMLS_D) /* {{{ */
|
Line 965 void zend_deactivate(TSRMLS_D) /* {{{ */
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
static int exec_done_cb(zend_module_entry *module TSRMLS_DC) /* {{{ */ |
|
{ |
|
if (module->post_deactivate_func) { |
|
module->post_deactivate_func(); |
|
} |
|
return 0; |
|
} |
|
/* }}} */ |
|
|
|
void zend_post_deactivate_modules(TSRMLS_D) /* {{{ */ |
|
{ |
|
zend_hash_apply(&module_registry, (apply_func_t) exec_done_cb TSRMLS_CC); |
|
zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC); |
|
} |
|
/* }}} */ |
|
|
|
BEGIN_EXTERN_C() |
BEGIN_EXTERN_C() |
ZEND_API void zend_message_dispatcher(long message, void *data TSRMLS_DC) /* {{{ */ | ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* {{{ */ |
{ |
{ |
if (zend_message_dispatcher_p) { |
if (zend_message_dispatcher_p) { |
zend_message_dispatcher_p(message, data TSRMLS_CC); |
zend_message_dispatcher_p(message, data TSRMLS_CC); |
Line 1054 ZEND_API void zend_error(int type, const char *format,
|
Line 1009 ZEND_API void zend_error(int type, const char *format,
|
zval ***params; |
zval ***params; |
zval *retval; |
zval *retval; |
zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context; |
zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context; |
char *error_filename; | const char *error_filename; |
uint error_lineno; |
uint error_lineno; |
zval *orig_user_error_handler; |
zval *orig_user_error_handler; |
zend_bool in_compilation; |
zend_bool in_compilation; |
Line 1066 ZEND_API void zend_error(int type, const char *format,
|
Line 1021 ZEND_API void zend_error(int type, const char *format,
|
zend_stack object_stack; |
zend_stack object_stack; |
zend_stack declare_stack; |
zend_stack declare_stack; |
zend_stack list_stack; |
zend_stack list_stack; |
zend_stack labels_stack; | zend_stack context_stack; |
TSRMLS_FETCH(); |
TSRMLS_FETCH(); |
|
|
|
/* Report about uncaught exception in case of fatal errors */ |
|
if (EG(exception)) { |
|
switch (type) { |
|
case E_CORE_ERROR: |
|
case E_ERROR: |
|
case E_RECOVERABLE_ERROR: |
|
case E_PARSE: |
|
case E_COMPILE_ERROR: |
|
case E_USER_ERROR: |
|
if (zend_is_executing(TSRMLS_C)) { |
|
error_lineno = zend_get_executed_lineno(TSRMLS_C); |
|
} |
|
zend_exception_error(EG(exception), E_WARNING TSRMLS_CC); |
|
EG(exception) = NULL; |
|
if (zend_is_executing(TSRMLS_C) && EG(opline_ptr)) { |
|
active_opline->lineno = error_lineno; |
|
} |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
|
|
/* Obtain relevant filename and lineno */ |
/* Obtain relevant filename and lineno */ |
switch (type) { |
switch (type) { |
case E_CORE_ERROR: |
case E_CORE_ERROR: |
Line 1109 ZEND_API void zend_error(int type, const char *format,
|
Line 1087 ZEND_API void zend_error(int type, const char *format,
|
error_filename = "Unknown"; |
error_filename = "Unknown"; |
} |
} |
|
|
|
#ifdef HAVE_DTRACE |
|
if(DTRACE_ERROR_ENABLED()) { |
|
char *dtrace_error_buffer; |
|
va_start(args, format); |
|
zend_vspprintf(&dtrace_error_buffer, 0, format, args); |
|
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno); |
|
efree(dtrace_error_buffer); |
|
va_end(args); |
|
} |
|
#endif /* HAVE_DTRACE */ |
|
|
va_start(args, format); |
va_start(args, format); |
|
|
/* if we don't have a user defined error handler */ |
/* if we don't have a user defined error handler */ |
Line 1190 ZEND_API void zend_error(int type, const char *format,
|
Line 1179 ZEND_API void zend_error(int type, const char *format,
|
* such scripts recursivly, but some CG() variables may be |
* such scripts recursivly, but some CG() variables may be |
* inconsistent. */ |
* inconsistent. */ |
|
|
in_compilation = zend_is_compiling(TSRMLS_C); | in_compilation = CG(in_compilation); |
if (in_compilation) { |
if (in_compilation) { |
saved_class_entry = CG(active_class_entry); |
saved_class_entry = CG(active_class_entry); |
CG(active_class_entry) = NULL; |
CG(active_class_entry) = NULL; |
Line 1201 ZEND_API void zend_error(int type, const char *format,
|
Line 1190 ZEND_API void zend_error(int type, const char *format,
|
SAVE_STACK(object_stack); |
SAVE_STACK(object_stack); |
SAVE_STACK(declare_stack); |
SAVE_STACK(declare_stack); |
SAVE_STACK(list_stack); |
SAVE_STACK(list_stack); |
SAVE_STACK(labels_stack); | SAVE_STACK(context_stack); |
| CG(in_compilation) = 0; |
} |
} |
|
|
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) { |
if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) { |
Line 1225 ZEND_API void zend_error(int type, const char *format,
|
Line 1215 ZEND_API void zend_error(int type, const char *format,
|
RESTORE_STACK(object_stack); |
RESTORE_STACK(object_stack); |
RESTORE_STACK(declare_stack); |
RESTORE_STACK(declare_stack); |
RESTORE_STACK(list_stack); |
RESTORE_STACK(list_stack); |
RESTORE_STACK(labels_stack); | RESTORE_STACK(context_stack); |
| CG(in_compilation) = 1; |
} |
} |
|
|
if (!EG(user_error_handler)) { |
if (!EG(user_error_handler)) { |
Line 1247 ZEND_API void zend_error(int type, const char *format,
|
Line 1238 ZEND_API void zend_error(int type, const char *format,
|
va_end(args); |
va_end(args); |
|
|
if (type == E_PARSE) { |
if (type == E_PARSE) { |
EG(exit_status) = 255; | /* eval() errors do not affect exit_status */ |
| if (!(EG(current_execute_data) && |
| EG(current_execute_data)->opline && |
| EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL && |
| EG(current_execute_data)->opline->extended_value == ZEND_EVAL)) { |
| EG(exit_status) = 255; |
| } |
zend_init_compiler_data_structures(TSRMLS_C); |
zend_init_compiler_data_structures(TSRMLS_C); |
} |
} |
} |
} |
Line 1290 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
Line 1287 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
zend_file_handle *file_handle; |
zend_file_handle *file_handle; |
zend_op_array *orig_op_array = EG(active_op_array); |
zend_op_array *orig_op_array = EG(active_op_array); |
zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr); |
zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr); |
|
long orig_interactive = CG(interactive); |
|
|
va_start(files, file_count); |
va_start(files, file_count); |
for (i = 0; i < file_count; i++) { |
for (i = 0; i < file_count; i++) { |
Line 1297 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
Line 1295 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
if (!file_handle) { |
if (!file_handle) { |
continue; |
continue; |
} |
} |
|
|
|
if (orig_interactive) { |
|
if (file_handle->filename[0] != '-' || file_handle->filename[1]) { |
|
CG(interactive) = 0; |
|
} else { |
|
CG(interactive) = 1; |
|
} |
|
} |
|
|
EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC); |
EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC); |
if (file_handle->opened_path) { |
if (file_handle->opened_path) { |
int dummy = 1; |
int dummy = 1; |
Line 1338 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
Line 1345 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
va_end(files); |
va_end(files); |
EG(active_op_array) = orig_op_array; |
EG(active_op_array) = orig_op_array; |
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; |
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; |
|
CG(interactive) = orig_interactive; |
return FAILURE; |
return FAILURE; |
} |
} |
} |
} |
va_end(files); |
va_end(files); |
EG(active_op_array) = orig_op_array; |
EG(active_op_array) = orig_op_array; |
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; |
EG(return_value_ptr_ptr) = orig_retval_ptr_ptr; |
|
CG(interactive) = orig_interactive; |
|
|
return SUCCESS; |
return SUCCESS; |
} |
} |
Line 1353 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
Line 1362 ZEND_API int zend_execute_scripts(int type TSRMLS_DC,
|
|
|
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */ |
ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */ |
{ |
{ |
char *cur_filename; | const char *cur_filename; |
int cur_lineno; |
int cur_lineno; |
char *compiled_string_description; |
char *compiled_string_description; |
|
|