version 1.1.1.2, 2012/05/29 12:34:35
|
version 1.1.1.3, 2013/07/22 01:32:11
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2013 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| This source file is subject to version 3.01 of the PHP 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 257 static void php_disable_classes(TSRMLS_D)
|
Line 257 static void php_disable_classes(TSRMLS_D)
|
|
|
/* {{{ php_binary_init |
/* {{{ php_binary_init |
*/ |
*/ |
static void php_binary_init(TSRMLS_D) | static void php_binary_init(TSRMLS_D) |
{ |
{ |
char *binary_location; |
char *binary_location; |
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
Line 597 PHPAPI int php_get_module_initialized(void)
|
Line 597 PHPAPI int php_get_module_initialized(void)
|
{ |
{ |
return module_initialized; |
return module_initialized; |
} |
} |
|
/* }}} */ |
|
|
/* {{{ php_log_err |
/* {{{ php_log_err |
*/ |
*/ |
Line 627 PHPAPI void php_log_err(char *log_message TSRMLS_DC)
|
Line 628 PHPAPI void php_log_err(char *log_message TSRMLS_DC)
|
char *error_time_str; |
char *error_time_str; |
|
|
time(&error_time); |
time(&error_time); |
error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC); | #ifdef ZTS |
| if (!php_during_module_startup()) { |
| error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); |
| } else { |
| error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 0 TSRMLS_CC); |
| } |
| #else |
| error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1 TSRMLS_CC); |
| #endif |
len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL); |
len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL); |
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
php_flock(fd, 2); |
php_flock(fd, 2); |
Line 836 PHPAPI void php_verror(const char *docref, const char
|
Line 845 PHPAPI void php_verror(const char *docref, const char
|
efree(docref_buf); |
efree(docref_buf); |
} |
} |
|
|
if (PG(track_errors) && module_initialized && | if (PG(track_errors) && module_initialized && |
(!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type))) { |
(!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type))) { |
if (!EG(active_symbol_table)) { |
if (!EG(active_symbol_table)) { |
zend_rebuild_symbol_table(TSRMLS_C); |
zend_rebuild_symbol_table(TSRMLS_C); |
Line 953 static void php_error_cb(int type, const char *error_f
|
Line 962 static void php_error_cb(int type, const char *error_f
|
/* store the error if it has changed */ |
/* store the error if it has changed */ |
if (display) { |
if (display) { |
#ifdef ZEND_SIGNALS |
#ifdef ZEND_SIGNALS |
HANDLE_BLOCK_INTERRUPTIONS(); | HANDLE_BLOCK_INTERRUPTIONS(); |
#endif |
#endif |
if (PG(last_error_message)) { |
if (PG(last_error_message)) { |
free(PG(last_error_message)); |
free(PG(last_error_message)); |
Line 1080 static void php_error_cb(int type, const char *error_f
|
Line 1089 static void php_error_cb(int type, const char *error_f
|
PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR |
PG(display_errors) == PHP_DISPLAY_ERRORS_STDERR |
) { |
) { |
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
fprintf(stderr, "%s: %s in %s on line%d\n", error_type_str, buffer, error_filename, error_lineno); | fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); |
fflush(stderr); |
fflush(stderr); |
#else |
#else |
fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); |
fprintf(stderr, "%s: %s in %s on line %d\n", error_type_str, buffer, error_filename, error_lineno); |
Line 1124 static void php_error_cb(int type, const char *error_f
|
Line 1133 static void php_error_cb(int type, const char *error_f
|
case E_PARSE: |
case E_PARSE: |
case E_COMPILE_ERROR: |
case E_COMPILE_ERROR: |
case E_USER_ERROR: |
case E_USER_ERROR: |
EG(exit_status) = 255; | { /* new block to allow variable definition */ |
| /* eval() errors do not affect exit_status or response code */ |
| zend_bool during_eval = (type == E_PARSE) && (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); |
| if (!during_eval) { |
| EG(exit_status) = 255; |
| } |
if (module_initialized) { |
if (module_initialized) { |
if (!PG(display_errors) && |
if (!PG(display_errors) && |
!SG(headers_sent) && |
!SG(headers_sent) && |
SG(sapi_headers).http_response_code == 200 | SG(sapi_headers).http_response_code == 200 && |
| !during_eval |
) { |
) { |
sapi_header_line ctr = {0}; |
sapi_header_line ctr = {0}; |
|
|
Line 1149 static void php_error_cb(int type, const char *error_f
|
Line 1167 static void php_error_cb(int type, const char *error_f
|
} |
} |
} |
} |
break; |
break; |
|
} |
} |
} |
|
|
/* Log if necessary */ |
/* Log if necessary */ |
Line 1202 PHPAPI char *php_get_current_user(TSRMLS_D)
|
Line 1221 PHPAPI char *php_get_current_user(TSRMLS_D)
|
name[len] = '\0'; |
name[len] = '\0'; |
SG(request_info).current_user_length = len; |
SG(request_info).current_user_length = len; |
SG(request_info).current_user = estrndup(name, len); |
SG(request_info).current_user = estrndup(name, len); |
return SG(request_info).current_user; | return SG(request_info).current_user; |
#else |
#else |
struct passwd *pwd; |
struct passwd *pwd; |
#if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) |
#if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) |
Line 1230 PHPAPI char *php_get_current_user(TSRMLS_D)
|
Line 1249 PHPAPI char *php_get_current_user(TSRMLS_D)
|
#if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) |
#if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) |
efree(pwbuf); |
efree(pwbuf); |
#endif |
#endif |
return SG(request_info).current_user; | return SG(request_info).current_user; |
#endif |
#endif |
} | } |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 1247 PHP_FUNCTION(set_time_limit)
|
Line 1266 PHP_FUNCTION(set_time_limit)
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &new_timeout) == FAILURE) { |
return; |
return; |
} |
} |
| |
new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, "%ld", new_timeout); |
new_timeout_strlen = zend_spprintf(&new_timeout_str, 0, "%ld", new_timeout); |
|
|
if (zend_alter_ini_entry_ex("max_execution_time", sizeof("max_execution_time"), new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { |
if (zend_alter_ini_entry_ex("max_execution_time", sizeof("max_execution_time"), new_timeout_str, new_timeout_strlen, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == SUCCESS) { |
Line 1740 void php_request_shutdown(void *dummy)
|
Line 1759 void php_request_shutdown(void *dummy)
|
} |
} |
} zend_end_try(); |
} zend_end_try(); |
|
|
/* 4. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */ | /* 4. Reset max_execution_time (no longer executing php code after response sent) */ |
zend_try { |
zend_try { |
php_output_deactivate(TSRMLS_C); |
|
} zend_end_try(); |
|
|
|
/* 5. Reset max_execution_time (no longer executing php code after response sent) */ |
|
zend_try { |
|
zend_unset_timeout(TSRMLS_C); |
zend_unset_timeout(TSRMLS_C); |
} zend_end_try(); |
} zend_end_try(); |
|
|
/* 6. Call all extensions RSHUTDOWN functions */ | /* 5. Call all extensions RSHUTDOWN functions */ |
if (PG(modules_activated)) { |
if (PG(modules_activated)) { |
zend_deactivate_modules(TSRMLS_C); |
zend_deactivate_modules(TSRMLS_C); |
php_free_shutdown_functions(TSRMLS_C); |
php_free_shutdown_functions(TSRMLS_C); |
} |
} |
|
|
|
/* 6. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */ |
|
zend_try { |
|
php_output_deactivate(TSRMLS_C); |
|
} zend_end_try(); |
|
|
/* 7. Destroy super-globals */ |
/* 7. Destroy super-globals */ |
zend_try { |
zend_try { |
int i; |
int i; |
Line 1881 static void core_globals_dtor(php_core_globals *core_g
|
Line 1900 static void core_globals_dtor(php_core_globals *core_g
|
PHP_MINFO_FUNCTION(php_core) { /* {{{ */ |
PHP_MINFO_FUNCTION(php_core) { /* {{{ */ |
php_info_print_table_start(); |
php_info_print_table_start(); |
php_info_print_table_row(2, "PHP Version", PHP_VERSION); |
php_info_print_table_row(2, "PHP Version", PHP_VERSION); |
php_info_print_table_end(); | php_info_print_table_end(); |
DISPLAY_INI_ENTRIES(); |
DISPLAY_INI_ENTRIES(); |
} |
} |
/* }}} */ |
/* }}} */ |
Line 2051 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2070 int php_module_startup(sapi_module_struct *sf, zend_mo
|
EG(exception_class) = NULL; |
EG(exception_class) = NULL; |
PG(disable_functions) = NULL; |
PG(disable_functions) = NULL; |
PG(disable_classes) = NULL; |
PG(disable_classes) = NULL; |
|
EG(exception) = NULL; |
|
EG(objects_store).object_buckets = NULL; |
|
|
#if HAVE_SETLOCALE |
#if HAVE_SETLOCALE |
setlocale(LC_CTYPE, ""); |
setlocale(LC_CTYPE, ""); |
Line 2157 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2178 int php_module_startup(sapi_module_struct *sf, zend_mo
|
return FAILURE; |
return FAILURE; |
} |
} |
|
|
/* initialize registry for images to be used in phpinfo() | /* initialize registry for images to be used in phpinfo() |
(this uses configuration parameters from php.ini) |
(this uses configuration parameters from php.ini) |
*/ |
*/ |
if (php_init_info_logos() == FAILURE) { |
if (php_init_info_logos() == FAILURE) { |
Line 2203 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2224 int php_module_startup(sapi_module_struct *sf, zend_mo
|
EG(current_module) = NULL; |
EG(current_module) = NULL; |
} |
} |
} |
} |
| |
/* disable certain classes and functions as requested by php.ini */ |
/* disable certain classes and functions as requested by php.ini */ |
php_disable_functions(TSRMLS_C); |
php_disable_functions(TSRMLS_C); |
php_disable_classes(TSRMLS_C); |
php_disable_classes(TSRMLS_C); |
Line 2238 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2259 int php_module_startup(sapi_module_struct *sf, zend_mo
|
const char *directives[16]; /* Remember to change this if the number of directives change */ |
const char *directives[16]; /* Remember to change this if the number of directives change */ |
} directives[2] = { |
} directives[2] = { |
{ |
{ |
E_DEPRECATED, | E_DEPRECATED, |
"Directive '%s' is deprecated in PHP 5.3 and greater", | "Directive '%s' is deprecated in PHP 5.3 and greater", |
{ |
{ |
NULL |
NULL |
} |
} |
}, | }, |
{ |
{ |
E_CORE_ERROR, | E_CORE_ERROR, |
"Directive '%s' is no longer available in PHP", | "Directive '%s' is no longer available in PHP", |
{ |
{ |
"allow_call_time_pass_reference", |
"allow_call_time_pass_reference", |
"define_syslog_variables", | "define_syslog_variables", |
"highlight.bg", | "highlight.bg", |
"magic_quotes_gpc", | "magic_quotes_gpc", |
"magic_quotes_runtime", | "magic_quotes_runtime", |
"magic_quotes_sybase", | "magic_quotes_sybase", |
"register_globals", | "register_globals", |
"register_long_arrays", | "register_long_arrays", |
"safe_mode", | "safe_mode", |
"safe_mode_gid", | "safe_mode_gid", |
"safe_mode_include_dir", | "safe_mode_include_dir", |
"safe_mode_exec_dir", | "safe_mode_exec_dir", |
"safe_mode_allowed_env_vars", | "safe_mode_allowed_env_vars", |
"safe_mode_protected_env_vars", | "safe_mode_protected_env_vars", |
"zend.ze1_compatibility_mode", | "zend.ze1_compatibility_mode", |
NULL |
NULL |
} |
} |
} |
} |
}; |
}; |
|
|
unsigned int i; |
unsigned int i; |
| |
zend_try { |
zend_try { |
/* 2 = Count of deprecation structs */ |
/* 2 = Count of deprecation structs */ |
for (i = 0; i < 2; i++) { |
for (i = 0; i < 2; i++) { |
Line 2289 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2310 int php_module_startup(sapi_module_struct *sf, zend_mo
|
retval = FAILURE; |
retval = FAILURE; |
} zend_end_try(); |
} zend_end_try(); |
} |
} |
| |
sapi_deactivate(TSRMLS_C); |
sapi_deactivate(TSRMLS_C); |
module_startup = 0; |
module_startup = 0; |
|
|
Line 2344 void php_module_shutdown(TSRMLS_D)
|
Line 2365 void php_module_shutdown(TSRMLS_D)
|
sapi_flush(TSRMLS_C); |
sapi_flush(TSRMLS_C); |
|
|
zend_shutdown(TSRMLS_C); |
zend_shutdown(TSRMLS_C); |
| |
/* Destroys filter & transport registries too */ |
/* Destroys filter & transport registries too */ |
php_shutdown_stream_wrappers(module_number TSRMLS_CC); |
php_shutdown_stream_wrappers(module_number TSRMLS_CC); |
|
|
Line 2388 PHPAPI int php_execute_script(zend_file_handle *primar
|
Line 2409 PHPAPI int php_execute_script(zend_file_handle *primar
|
zend_file_handle *prepend_file_p, *append_file_p; |
zend_file_handle *prepend_file_p, *append_file_p; |
zend_file_handle prepend_file = {0}, append_file = {0}; |
zend_file_handle prepend_file = {0}, append_file = {0}; |
#if HAVE_BROKEN_GETCWD |
#if HAVE_BROKEN_GETCWD |
int old_cwd_fd = -1; | volatile int old_cwd_fd = -1; |
#else |
#else |
char *old_cwd; |
char *old_cwd; |
ALLOCA_FLAG(use_heap) |
ALLOCA_FLAG(use_heap) |