version 1.1, 2012/02/21 23:48:05
|
version 1.1.1.5, 2014/06/15 20:04:01
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2014 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 82
|
Line 82
|
#include "zend_indent.h" |
#include "zend_indent.h" |
#include "zend_extensions.h" |
#include "zend_extensions.h" |
#include "zend_ini.h" |
#include "zend_ini.h" |
|
#include "zend_dtrace.h" |
|
|
#include "php_content_types.h" |
#include "php_content_types.h" |
#include "php_ticks.h" |
#include "php_ticks.h" |
Line 91
|
Line 92
|
|
|
#include "SAPI.h" |
#include "SAPI.h" |
#include "rfc1867.h" |
#include "rfc1867.h" |
#if SUHOSIN_PATCH |
|
#include "suhosin_globals.h" |
|
#endif |
|
|
|
#if HAVE_MMAP | #if HAVE_MMAP || defined(PHP_WIN32) |
# if HAVE_UNISTD_H |
# if HAVE_UNISTD_H |
# include <unistd.h> |
# include <unistd.h> |
# if defined(_SC_PAGESIZE) |
# if defined(_SC_PAGESIZE) |
Line 117
|
Line 115
|
#endif |
#endif |
/* }}} */ |
/* }}} */ |
|
|
|
#ifndef S_ISREG |
|
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) |
|
#endif |
|
|
PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_internal_extensions; |
PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_internal_extensions; |
|
|
#ifndef ZTS |
#ifndef ZTS |
Line 128 PHPAPI int core_globals_id;
|
Line 130 PHPAPI int core_globals_id;
|
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
#include "win32_internal_function_disabled.h" |
#include "win32_internal_function_disabled.h" |
|
|
static php_win32_disable_functions() { | static php_win32_disable_functions(TSRMLS_D) |
| { |
int i; |
int i; |
TSRMLS_FETCH(); |
|
|
|
if (EG(windows_version_info).dwMajorVersion < 5) { |
if (EG(windows_version_info).dwMajorVersion < 5) { |
for (i = 0; i < function_name_cnt_5; i++) { |
for (i = 0; i < function_name_cnt_5; i++) { |
Line 257 static void php_disable_classes(TSRMLS_D)
|
Line 259 static void php_disable_classes(TSRMLS_D)
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
/* {{{ php_binary_init |
|
*/ |
|
static void php_binary_init(TSRMLS_D) |
|
{ |
|
char *binary_location; |
|
#ifdef PHP_WIN32 |
|
binary_location = (char *)malloc(MAXPATHLEN); |
|
if (GetModuleFileName(0, binary_location, MAXPATHLEN) == 0) { |
|
free(binary_location); |
|
PG(php_binary) = NULL; |
|
} |
|
#else |
|
if (sapi_module.executable_location) { |
|
binary_location = (char *)malloc(MAXPATHLEN); |
|
if (!strchr(sapi_module.executable_location, '/')) { |
|
char *envpath, *path; |
|
int found = 0; |
|
|
|
if ((envpath = getenv("PATH")) != NULL) { |
|
char *search_dir, search_path[MAXPATHLEN]; |
|
char *last = NULL; |
|
struct stat s; |
|
|
|
path = estrdup(envpath); |
|
search_dir = php_strtok_r(path, ":", &last); |
|
|
|
while (search_dir) { |
|
snprintf(search_path, MAXPATHLEN, "%s/%s", search_dir, sapi_module.executable_location); |
|
if (VCWD_REALPATH(search_path, binary_location) && !VCWD_ACCESS(binary_location, X_OK) && VCWD_STAT(binary_location, &s) == 0 && S_ISREG(s.st_mode)) { |
|
found = 1; |
|
break; |
|
} |
|
search_dir = php_strtok_r(NULL, ":", &last); |
|
} |
|
efree(path); |
|
} |
|
if (!found) { |
|
free(binary_location); |
|
binary_location = NULL; |
|
} |
|
} else if (!VCWD_REALPATH(sapi_module.executable_location, binary_location) || VCWD_ACCESS(binary_location, X_OK)) { |
|
free(binary_location); |
|
binary_location = NULL; |
|
} |
|
} else { |
|
binary_location = NULL; |
|
} |
|
#endif |
|
PG(php_binary) = binary_location; |
|
} |
|
/* }}} */ |
|
|
/* {{{ PHP_INI_MH |
/* {{{ PHP_INI_MH |
*/ |
*/ |
static PHP_INI_MH(OnUpdateTimeout) |
static PHP_INI_MH(OnUpdateTimeout) |
Line 368 static PHP_INI_MH(OnUpdateErrorLog)
|
Line 422 static PHP_INI_MH(OnUpdateErrorLog)
|
{ |
{ |
/* Only do the safemode/open_basedir check at runtime */ |
/* Only do the safemode/open_basedir check at runtime */ |
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value, "syslog")) { |
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value, "syslog")) { |
if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { |
|
return FAILURE; |
|
} |
|
|
|
if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) { |
if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) { |
return FAILURE; |
return FAILURE; |
} |
} |
|
|
} |
} |
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
return SUCCESS; |
return SUCCESS; |
Line 388 static PHP_INI_MH(OnUpdateMailLog)
|
Line 437 static PHP_INI_MH(OnUpdateMailLog)
|
{ |
{ |
/* Only do the safemode/open_basedir check at runtime */ |
/* Only do the safemode/open_basedir check at runtime */ |
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) { |
if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) { |
if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { |
|
return FAILURE; |
|
} |
|
|
|
if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) { |
if (PG(open_basedir) && php_check_open_basedir(new_value TSRMLS_CC)) { |
return FAILURE; |
return FAILURE; |
} |
} |
|
|
} |
} |
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
return SUCCESS; |
return SUCCESS; |
Line 417 static PHP_INI_MH(OnChangeMailForceExtra)
|
Line 461 static PHP_INI_MH(OnChangeMailForceExtra)
|
/* defined in browscap.c */ |
/* defined in browscap.c */ |
PHP_INI_MH(OnChangeBrowscap); |
PHP_INI_MH(OnChangeBrowscap); |
|
|
/* Need to convert to strings and make use of: | |
* PHP_SAFE_MODE | /* Need to be read from the environment (?): |
* | |
* Need to be read from the environment (?): | |
* PHP_AUTO_PREPEND_FILE |
* PHP_AUTO_PREPEND_FILE |
* PHP_AUTO_APPEND_FILE |
* PHP_AUTO_APPEND_FILE |
* PHP_DOCUMENT_ROOT |
* PHP_DOCUMENT_ROOT |
Line 428 PHP_INI_MH(OnChangeBrowscap);
|
Line 470 PHP_INI_MH(OnChangeBrowscap);
|
* PHP_INCLUDE_PATH |
* PHP_INCLUDE_PATH |
*/ |
*/ |
|
|
#ifndef PHP_SAFE_MODE_EXEC_DIR |
|
# define PHP_SAFE_MODE_EXEC_DIR "" |
|
#endif |
|
|
|
/* Windows and Netware use the internal mail */ |
/* Windows and Netware use the internal mail */ |
#if defined(PHP_WIN32) || defined(NETWARE) |
#if defined(PHP_WIN32) || defined(NETWARE) |
# define DEFAULT_SENDMAIL_PATH NULL |
# define DEFAULT_SENDMAIL_PATH NULL |
Line 444 PHP_INI_MH(OnChangeBrowscap);
|
Line 482 PHP_INI_MH(OnChangeBrowscap);
|
/* {{{ PHP_INI |
/* {{{ PHP_INI |
*/ |
*/ |
PHP_INI_BEGIN() |
PHP_INI_BEGIN() |
PHP_INI_ENTRY_EX("define_syslog_variables", "0", PHP_INI_ALL, NULL, php_ini_boolean_displayer_cb) |
|
PHP_INI_ENTRY_EX("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
|
PHP_INI_ENTRY_EX("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) |
|
|
STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals) |
|
STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals) |
STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals) |
STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode) |
STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode) |
STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals) |
Line 472 PHP_INI_BEGIN()
|
Line 507 PHP_INI_BEGIN()
|
STD_PHP_INI_BOOLEAN("ignore_repeated_source", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_source, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("ignore_repeated_source", "0", PHP_INI_ALL, OnUpdateBool, ignore_repeated_source, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateBool, report_memleaks, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("report_memleaks", "1", PHP_INI_ALL, OnUpdateBool, report_memleaks, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("report_zend_debug", "1", PHP_INI_ALL, OnUpdateBool, report_zend_debug, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("report_zend_debug", "1", PHP_INI_ALL, OnUpdateBool, report_zend_debug, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals) |
|
STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals) |
|
STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals) |
|
STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateLong, output_buffering, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateLong, output_buffering, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, output_handler, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateString, output_handler, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_argc_argv, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("register_globals", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_globals, php_core_globals, core_globals) |
|
STD_PHP_INI_BOOLEAN("register_long_arrays", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, register_long_arrays, php_core_globals, core_globals) |
|
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("auto_globals_jit", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateBool, auto_globals_jit, php_core_globals, core_globals) |
#if PHP_SAFE_MODE |
|
STD_PHP_INI_BOOLEAN("safe_mode", "1", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals) |
|
#else |
|
STD_PHP_INI_BOOLEAN("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode, php_core_globals, core_globals) |
|
#endif |
|
STD_PHP_INI_ENTRY("safe_mode_include_dir", NULL, PHP_INI_SYSTEM, OnUpdateString, safe_mode_include_dir, php_core_globals, core_globals) |
|
STD_PHP_INI_BOOLEAN("safe_mode_gid", "0", PHP_INI_SYSTEM, OnUpdateBool, safe_mode_gid, php_core_globals, core_globals) |
|
STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals) |
STD_PHP_INI_BOOLEAN("short_open_tag", DEFAULT_SHORT_OPEN_TAG, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, short_tags, zend_compiler_globals, compiler_globals) |
STD_PHP_INI_BOOLEAN("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, sql_safe_mode, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateBool, sql_safe_mode, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("track_errors", "0", PHP_INI_ALL, OnUpdateBool, track_errors, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("y2k_compliance", "1", PHP_INI_ALL, OnUpdateBool, y2k_compliance, php_core_globals, core_globals) |
|
|
|
STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("unserialize_callback_func", NULL, PHP_INI_ALL, OnUpdateString, unserialize_callback_func, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("serialize_precision", "17", PHP_INI_ALL, OnUpdateLongGEZero, serialize_precision, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("serialize_precision", "17", PHP_INI_ALL, OnUpdateLongGEZero, serialize_precision, php_core_globals, core_globals) |
Line 507 PHP_INI_BEGIN()
|
Line 529 PHP_INI_BEGIN()
|
STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("include_path", PHP_INCLUDE_PATH, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("include_path", PHP_INCLUDE_PATH, PHP_INI_ALL, OnUpdateStringUnempty, include_path, php_core_globals, core_globals) |
PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateTimeout) |
PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnUpdateTimeout) |
PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_ALL, OnUpdateBaseDir) | STD_PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_ALL, OnUpdateBaseDir, open_basedir, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("safe_mode_exec_dir", PHP_SAFE_MODE_EXEC_DIR, PHP_INI_SYSTEM, OnUpdateString, safe_mode_exec_dir, php_core_globals, core_globals) | |
|
|
STD_PHP_INI_BOOLEAN("file_uploads", "1", PHP_INI_SYSTEM, OnUpdateBool, file_uploads, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("file_uploads", "1", PHP_INI_SYSTEM, OnUpdateBool, file_uploads, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("upload_max_filesize", "2M", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, upload_max_filesize, php_core_globals, core_globals) |
STD_PHP_INI_ENTRY("upload_max_filesize", "2M", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, upload_max_filesize, php_core_globals, core_globals) |
Line 536 PHP_INI_BEGIN()
|
Line 557 PHP_INI_BEGIN()
|
PHP_INI_ENTRY("mail.force_extra_parameters",NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnChangeMailForceExtra) |
PHP_INI_ENTRY("mail.force_extra_parameters",NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnChangeMailForceExtra) |
PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL) |
PHP_INI_ENTRY("disable_functions", "", PHP_INI_SYSTEM, NULL) |
PHP_INI_ENTRY("disable_classes", "", PHP_INI_SYSTEM, NULL) |
PHP_INI_ENTRY("disable_classes", "", PHP_INI_SYSTEM, NULL) |
PHP_INI_ENTRY("max_file_uploads", "20", PHP_INI_SYSTEM, NULL) | PHP_INI_ENTRY("max_file_uploads", "20", PHP_INI_SYSTEM|PHP_INI_PERDIR, NULL) |
|
|
STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("allow_url_include", "0", PHP_INI_SYSTEM, OnUpdateBool, allow_url_include, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("allow_url_include", "0", PHP_INI_SYSTEM, OnUpdateBool, allow_url_include, php_core_globals, core_globals) |
|
STD_PHP_INI_BOOLEAN("enable_post_data_reading", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, enable_post_data_reading, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) |
STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) |
|
|
STD_PHP_INI_ENTRY("realpath_cache_size", "16K", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_size_limit, virtual_cwd_globals, cwd_globals) |
STD_PHP_INI_ENTRY("realpath_cache_size", "16K", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_size_limit, virtual_cwd_globals, cwd_globals) |
Line 574 static int php_during_module_shutdown(void)
|
Line 596 static int php_during_module_shutdown(void)
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
/* {{{ php_get_module_initialized |
|
*/ |
|
PHPAPI int php_get_module_initialized(void) |
|
{ |
|
return module_initialized; |
|
} |
|
/* }}} */ |
|
|
/* {{{ php_log_err |
/* {{{ php_log_err |
*/ |
*/ |
PHPAPI void php_log_err(char *log_message TSRMLS_DC) |
PHPAPI void php_log_err(char *log_message TSRMLS_DC) |
Line 603 PHPAPI void php_log_err(char *log_message TSRMLS_DC)
|
Line 633 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); |
#endif |
#endif |
write(fd, tmp, len); | php_ignore_value(write(fd, tmp, len)); |
efree(tmp); |
efree(tmp); |
efree(error_time_str); |
efree(error_time_str); |
close(fd); |
close(fd); |
Line 620 PHPAPI void php_log_err(char *log_message TSRMLS_DC)
|
Line 658 PHPAPI void php_log_err(char *log_message TSRMLS_DC)
|
/* Otherwise fall back to the default logging location, if we have one */ |
/* Otherwise fall back to the default logging location, if we have one */ |
|
|
if (sapi_module.log_message) { |
if (sapi_module.log_message) { |
sapi_module.log_message(log_message); | sapi_module.log_message(log_message TSRMLS_CC); |
} |
} |
PG(in_error_log) = 0; |
PG(in_error_log) = 0; |
} |
} |
Line 666 PHPAPI void php_verror(const char *docref, const char
|
Line 704 PHPAPI void php_verror(const char *docref, const char
|
char *docref_target = "", *docref_root = ""; |
char *docref_target = "", *docref_root = ""; |
char *p; |
char *p; |
int buffer_len = 0; |
int buffer_len = 0; |
char *space = ""; | const char *space = ""; |
char *class_name = ""; | const char *class_name = ""; |
char *function; | const char *function; |
int origin_len; |
int origin_len; |
char *origin; |
char *origin; |
char *message; |
char *message; |
Line 676 PHPAPI void php_verror(const char *docref, const char
|
Line 714 PHPAPI void php_verror(const char *docref, const char
|
|
|
/* get error text into buffer and escape for html if necessary */ |
/* get error text into buffer and escape for html if necessary */ |
buffer_len = vspprintf(&buffer, 0, format, args); |
buffer_len = vspprintf(&buffer, 0, format, args); |
|
|
if (PG(html_errors)) { |
if (PG(html_errors)) { |
int len; | size_t len; |
char *replace = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC); |
char *replace = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC); |
efree(buffer); |
efree(buffer); |
buffer = replace; |
buffer = replace; |
Line 693 PHPAPI void php_verror(const char *docref, const char
|
Line 732 PHPAPI void php_verror(const char *docref, const char
|
EG(current_execute_data)->opline && |
EG(current_execute_data)->opline && |
EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL |
EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL |
) { |
) { |
switch (EG(current_execute_data)->opline->op2.u.constant.value.lval) { | switch (EG(current_execute_data)->opline->extended_value) { |
case ZEND_EVAL: |
case ZEND_EVAL: |
function = "eval"; |
function = "eval"; |
is_function = 1; |
is_function = 1; |
Line 735 PHPAPI void php_verror(const char *docref, const char
|
Line 774 PHPAPI void php_verror(const char *docref, const char
|
} |
} |
|
|
if (PG(html_errors)) { |
if (PG(html_errors)) { |
int len; | size_t len; |
char *replace = php_escape_html_entities(origin, origin_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC); |
char *replace = php_escape_html_entities(origin, origin_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC); |
efree(origin); |
efree(origin); |
origin = replace; |
origin = replace; |
Line 750 PHPAPI void php_verror(const char *docref, const char
|
Line 789 PHPAPI void php_verror(const char *docref, const char
|
/* no docref given but function is known (the default) */ |
/* no docref given but function is known (the default) */ |
if (!docref && is_function) { |
if (!docref && is_function) { |
int doclen; |
int doclen; |
|
while (*function == '_') { |
|
function++; |
|
} |
if (space[0] == '\0') { |
if (space[0] == '\0') { |
doclen = spprintf(&docref_buf, 0, "function.%s", function); |
doclen = spprintf(&docref_buf, 0, "function.%s", function); |
} else { |
} else { |
Line 762 PHPAPI void php_verror(const char *docref, const char
|
Line 804 PHPAPI void php_verror(const char *docref, const char
|
} |
} |
|
|
/* we have a docref for a function AND |
/* we have a docref for a function AND |
* - we show erroes in html mode OR | * - we show errors in html mode AND |
* - the user wants to see the links anyway | * - the user wants to see the links |
*/ |
*/ |
if (docref && is_function && (PG(html_errors) || strlen(PG(docref_root)))) { | if (docref && is_function && PG(html_errors) && strlen(PG(docref_root))) { |
if (strncmp(docref, "http://", 7)) { |
if (strncmp(docref, "http://", 7)) { |
/* We don't have 'http://' so we use docref_root */ |
/* We don't have 'http://' so we use docref_root */ |
|
|
Line 811 PHPAPI void php_verror(const char *docref, const char
|
Line 853 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 927 static void php_error_cb(int type, const char *error_f
|
Line 969 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 |
|
HANDLE_BLOCK_INTERRUPTIONS(); |
|
#endif |
if (PG(last_error_message)) { |
if (PG(last_error_message)) { |
free(PG(last_error_message)); |
free(PG(last_error_message)); |
PG(last_error_message) = NULL; |
PG(last_error_message) = NULL; |
Line 935 static void php_error_cb(int type, const char *error_f
|
Line 980 static void php_error_cb(int type, const char *error_f
|
free(PG(last_error_file)); |
free(PG(last_error_file)); |
PG(last_error_file) = NULL; |
PG(last_error_file) = NULL; |
} |
} |
|
#ifdef ZEND_SIGNALS |
|
HANDLE_UNBLOCK_INTERRUPTIONS(); |
|
#endif |
if (!error_filename) { |
if (!error_filename) { |
error_filename = "Unknown"; |
error_filename = "Unknown"; |
} |
} |
Line 1027 static void php_error_cb(int type, const char *error_f
|
Line 1075 static void php_error_cb(int type, const char *error_f
|
efree(log_buffer); |
efree(log_buffer); |
} |
} |
|
|
if (PG(display_errors) | if (PG(display_errors) && ((module_initialized && !PG(during_request_startup)) || (PG(display_startup_errors)))) { |
&& ((module_initialized && !PG(during_request_startup)) | |
|| (PG(display_startup_errors) | |
&& (OG(php_body_write)==php_default_output_func || OG(php_body_write)==php_ub_body_write_no_header || OG(php_body_write)==php_ub_body_write) | |
) | |
) | |
) { | |
| |
if (PG(xmlrpc_errors)) { |
if (PG(xmlrpc_errors)) { |
php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>%ld</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %d</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, buffer, error_filename, error_lineno); |
php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>%ld</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %d</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, buffer, error_filename, error_lineno); |
} else { |
} else { |
Line 1042 static void php_error_cb(int type, const char *error_f
|
Line 1083 static void php_error_cb(int type, const char *error_f
|
char *append_string = INI_STR("error_append_string"); |
char *append_string = INI_STR("error_append_string"); |
|
|
if (PG(html_errors)) { |
if (PG(html_errors)) { |
if (type == E_ERROR) { | if (type == E_ERROR || type == E_PARSE) { |
int len; | size_t len; |
char *buf = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC); |
char *buf = php_escape_html_entities(buffer, buffer_len, &len, 0, ENT_COMPAT, NULL TSRMLS_CC); |
php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buf, error_filename, error_lineno, STR_PRINT(append_string)); |
php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buf, error_filename, error_lineno, STR_PRINT(append_string)); |
efree(buf); |
efree(buf); |
Line 1056 static void php_error_cb(int type, const char *error_f
|
Line 1097 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 1100 static void php_error_cb(int type, const char *error_f
|
Line 1141 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}; |
|
|
ctr.line = "HTTP/1.0 500 Internal Server Error"; |
ctr.line = "HTTP/1.0 500 Internal Server Error"; |
ctr.line_len = strlen(ctr.line); | ctr.line_len = sizeof("HTTP/1.0 500 Internal Server Error") - 1; |
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); |
sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); |
} |
} |
/* the parser would return 1 (failure), we can bail out nicely */ |
/* the parser would return 1 (failure), we can bail out nicely */ |
if (type != E_PARSE) { | if (type == E_PARSE) { |
| CG(parse_error) = 0; |
| } else { |
/* restore memory limit */ |
/* restore memory limit */ |
zend_set_memory_limit(PG(memory_limit)); |
zend_set_memory_limit(PG(memory_limit)); |
efree(buffer); |
efree(buffer); |
Line 1123 static void php_error_cb(int type, const char *error_f
|
Line 1175 static void php_error_cb(int type, const char *error_f
|
} |
} |
} |
} |
break; |
break; |
|
} |
} |
} |
|
|
/* Log if necessary */ |
/* Log if necessary */ |
Line 1147 static void php_error_cb(int type, const char *error_f
|
Line 1200 static void php_error_cb(int type, const char *error_f
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
/* {{{ php_get_current_user |
|
*/ |
|
PHPAPI char *php_get_current_user(TSRMLS_D) |
|
{ |
|
struct stat *pstat; |
|
|
|
if (SG(request_info).current_user) { |
|
return SG(request_info).current_user; |
|
} |
|
|
|
/* FIXME: I need to have this somehow handled if |
|
USE_SAPI is defined, because cgi will also be |
|
interfaced in USE_SAPI */ |
|
|
|
pstat = sapi_get_stat(TSRMLS_C); |
|
|
|
if (!pstat) { |
|
return ""; |
|
} else { |
|
#ifdef PHP_WIN32 |
|
char name[256]; |
|
DWORD len = sizeof(name)-1; |
|
|
|
if (!GetUserName(name, &len)) { |
|
return ""; |
|
} |
|
name[len] = '\0'; |
|
SG(request_info).current_user_length = len; |
|
SG(request_info).current_user = estrndup(name, len); |
|
return SG(request_info).current_user; |
|
#else |
|
struct passwd *pwd; |
|
#if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) |
|
struct passwd _pw; |
|
struct passwd *retpwptr = NULL; |
|
int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); |
|
char *pwbuf; |
|
|
|
if (pwbuflen < 1) { |
|
return ""; |
|
} |
|
pwbuf = emalloc(pwbuflen); |
|
if (getpwuid_r(pstat->st_uid, &_pw, pwbuf, pwbuflen, &retpwptr) != 0) { |
|
efree(pwbuf); |
|
return ""; |
|
} |
|
pwd = &_pw; |
|
#else |
|
if ((pwd=getpwuid(pstat->st_uid))==NULL) { |
|
return ""; |
|
} |
|
#endif |
|
SG(request_info).current_user_length = strlen(pwd->pw_name); |
|
SG(request_info).current_user = estrndup(pwd->pw_name, SG(request_info).current_user_length); |
|
#if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) |
|
efree(pwbuf); |
|
#endif |
|
return SG(request_info).current_user; |
|
#endif |
|
} |
|
} |
|
/* }}} */ |
|
|
/* {{{ proto bool set_time_limit(int seconds) |
/* {{{ proto bool set_time_limit(int seconds) |
Sets the maximum time a script can run */ |
Sets the maximum time a script can run */ |
PHP_FUNCTION(set_time_limit) |
PHP_FUNCTION(set_time_limit) |
Line 1155 PHP_FUNCTION(set_time_limit)
|
Line 1271 PHP_FUNCTION(set_time_limit)
|
char *new_timeout_str; |
char *new_timeout_str; |
int new_timeout_strlen; |
int new_timeout_strlen; |
|
|
if (PG(safe_mode)) { |
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot set time limit in safe mode"); |
|
RETURN_FALSE; |
|
} |
|
|
|
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 1179 PHP_FUNCTION(set_time_limit)
|
Line 1290 PHP_FUNCTION(set_time_limit)
|
*/ |
*/ |
static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path TSRMLS_DC) |
static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path TSRMLS_DC) |
{ |
{ |
return php_stream_open_wrapper_as_file((char *)filename, "rb", ENFORCE_SAFE_MODE|USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, opened_path); | return php_stream_open_wrapper_as_file((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE, opened_path); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 1208 static size_t php_zend_stream_fsizer(void *handle TSRM
|
Line 1319 static size_t php_zend_stream_fsizer(void *handle TSRM
|
|
|
static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */ |
static int php_stream_open_for_zend(const char *filename, zend_file_handle *handle TSRMLS_DC) /* {{{ */ |
{ |
{ |
return php_stream_open_for_zend_ex(filename, handle, ENFORCE_SAFE_MODE|USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); | return php_stream_open_for_zend_ex(filename, handle, USE_PATH|REPORT_ERRORS|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 1219 PHPAPI int php_stream_open_for_zend_ex(const char *fil
|
Line 1330 PHPAPI int php_stream_open_for_zend_ex(const char *fil
|
php_stream *stream = php_stream_open_wrapper((char *)filename, "rb", mode, &handle->opened_path); |
php_stream *stream = php_stream_open_wrapper((char *)filename, "rb", mode, &handle->opened_path); |
|
|
if (stream) { |
if (stream) { |
#if HAVE_MMAP | #if HAVE_MMAP || defined(PHP_WIN32) |
size_t page_size = REAL_PAGE_SIZE; |
size_t page_size = REAL_PAGE_SIZE; |
#endif |
#endif |
|
|
Line 1233 PHPAPI int php_stream_open_for_zend_ex(const char *fil
|
Line 1344 PHPAPI int php_stream_open_for_zend_ex(const char *fil
|
memset(&handle->handle.stream.mmap, 0, sizeof(handle->handle.stream.mmap)); |
memset(&handle->handle.stream.mmap, 0, sizeof(handle->handle.stream.mmap)); |
len = php_zend_stream_fsizer(stream TSRMLS_CC); |
len = php_zend_stream_fsizer(stream TSRMLS_CC); |
if (len != 0 |
if (len != 0 |
#if HAVE_MMAP | #if HAVE_MMAP || defined(PHP_WIN32) |
&& ((len - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD |
&& ((len - 1) % page_size) <= page_size - ZEND_MMAP_AHEAD |
#endif |
#endif |
&& php_stream_mmap_possible(stream) |
&& php_stream_mmap_possible(stream) |
Line 1278 static int php_get_configuration_directive_for_zend(co
|
Line 1389 static int php_get_configuration_directive_for_zend(co
|
|
|
/* {{{ php_message_handler_for_zend |
/* {{{ php_message_handler_for_zend |
*/ |
*/ |
static void php_message_handler_for_zend(long message, void *data TSRMLS_DC) | static void php_message_handler_for_zend(long message, const void *data TSRMLS_DC) |
{ |
{ |
switch (message) { |
switch (message) { |
case ZMSG_FAILED_INCLUDE_FOPEN: |
case ZMSG_FAILED_INCLUDE_FOPEN: |
Line 1372 void php_on_timeout(int seconds TSRMLS_DC)
|
Line 1483 void php_on_timeout(int seconds TSRMLS_DC)
|
*/ |
*/ |
static void sigchld_handler(int apar) |
static void sigchld_handler(int apar) |
{ |
{ |
|
int errno_save = errno; |
|
|
while (waitpid(-1, NULL, WNOHANG) > 0); |
while (waitpid(-1, NULL, WNOHANG) > 0); |
signal(SIGCHLD, sigchld_handler); |
signal(SIGCHLD, sigchld_handler); |
|
|
|
errno = errno_save; |
} |
} |
/* }}} */ |
/* }}} */ |
#endif |
#endif |
Line 1415 int php_request_startup(TSRMLS_D)
|
Line 1530 int php_request_startup(TSRMLS_D)
|
{ |
{ |
int retval = SUCCESS; |
int retval = SUCCESS; |
|
|
|
#ifdef HAVE_DTRACE |
|
DTRACE_REQUEST_STARTUP(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), (char *)SAFE_FILENAME(SG(request_info).request_method)); |
|
#endif /* HAVE_DTRACE */ |
|
|
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
PG(com_initialized) = 0; |
PG(com_initialized) = 0; |
#endif |
#endif |
Line 1438 int php_request_startup(TSRMLS_D)
|
Line 1557 int php_request_startup(TSRMLS_D)
|
zend_activate(TSRMLS_C); |
zend_activate(TSRMLS_C); |
sapi_activate(TSRMLS_C); |
sapi_activate(TSRMLS_C); |
|
|
|
#ifdef ZEND_SIGNALS |
|
zend_signal_activate(TSRMLS_C); |
|
#endif |
|
|
if (PG(max_input_time) == -1) { |
if (PG(max_input_time) == -1) { |
zend_set_timeout(EG(timeout_seconds), 1); |
zend_set_timeout(EG(timeout_seconds), 1); |
} else { |
} else { |
zend_set_timeout(PG(max_input_time), 1); |
zend_set_timeout(PG(max_input_time), 1); |
} |
} |
|
|
/* Disable realpath cache if safe_mode or open_basedir are set */ | /* Disable realpath cache if an open_basedir is set */ |
if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) { | if (PG(open_basedir) && *PG(open_basedir)) { |
CWDG(realpath_cache_size_limit) = 0; |
CWDG(realpath_cache_size_limit) = 0; |
} |
} |
|
|
Line 1454 int php_request_startup(TSRMLS_D)
|
Line 1577 int php_request_startup(TSRMLS_D)
|
} |
} |
|
|
if (PG(output_handler) && PG(output_handler)[0]) { |
if (PG(output_handler) && PG(output_handler)[0]) { |
php_start_ob_buffer_named(PG(output_handler), 0, 1 TSRMLS_CC); | zval *oh; |
| |
| MAKE_STD_ZVAL(oh); |
| ZVAL_STRING(oh, PG(output_handler), 1); |
| php_output_start_user(oh, 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); |
| zval_ptr_dtor(&oh); |
} else if (PG(output_buffering)) { |
} else if (PG(output_buffering)) { |
if (PG(output_buffering)>1) { | php_output_start_user(NULL, PG(output_buffering) > 1 ? PG(output_buffering) : 0, PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC); |
php_start_ob_buffer(NULL, PG(output_buffering), 1 TSRMLS_CC); | |
} else { | |
php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); | |
} | |
} else if (PG(implicit_flush)) { |
} else if (PG(implicit_flush)) { |
php_start_implicit_flush(TSRMLS_C); | php_output_set_implicit_flush(1 TSRMLS_CC); |
} |
} |
|
|
/* We turn this off in php_execute_script() */ |
/* We turn this off in php_execute_script() */ |
Line 1498 int php_request_startup(TSRMLS_D)
|
Line 1622 int php_request_startup(TSRMLS_D)
|
|
|
zend_try { |
zend_try { |
PG(during_request_startup) = 1; |
PG(during_request_startup) = 1; |
php_output_activate(TSRMLS_C); |
|
if (PG(expose_php)) { |
if (PG(expose_php)) { |
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1); |
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1); |
} |
} |
Line 1542 void php_request_shutdown_for_exec(void *dummy)
|
Line 1665 void php_request_shutdown_for_exec(void *dummy)
|
/* used to close fd's in the 3..255 range here, but it's problematic |
/* used to close fd's in the 3..255 range here, but it's problematic |
*/ |
*/ |
shutdown_memory_manager(1, 1 TSRMLS_CC); |
shutdown_memory_manager(1, 1 TSRMLS_CC); |
|
zend_interned_strings_restore(TSRMLS_C); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 1561 void php_request_shutdown_for_hook(void *dummy)
|
Line 1685 void php_request_shutdown_for_hook(void *dummy)
|
} |
} |
|
|
zend_try { |
zend_try { |
|
zend_unset_timeout(TSRMLS_C); |
|
} zend_end_try(); |
|
|
|
zend_try { |
int i; |
int i; |
|
|
for (i = 0; i < NUM_TRACK_VARS; i++) { |
for (i = 0; i < NUM_TRACK_VARS; i++) { |
Line 1584 void php_request_shutdown_for_hook(void *dummy)
|
Line 1712 void php_request_shutdown_for_hook(void *dummy)
|
shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC); |
shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC); |
} zend_end_try(); |
} zend_end_try(); |
|
|
|
zend_interned_strings_restore(TSRMLS_C); |
|
|
|
#ifdef ZEND_SIGNALS |
zend_try { |
zend_try { |
zend_unset_timeout(TSRMLS_C); | zend_signal_deactivate(TSRMLS_C); |
} zend_end_try(); |
} zend_end_try(); |
|
#endif |
} |
} |
|
|
/* }}} */ |
/* }}} */ |
Line 1621 void php_request_shutdown(void *dummy)
|
Line 1753 void php_request_shutdown(void *dummy)
|
/* 3. Flush all output buffers */ |
/* 3. Flush all output buffers */ |
zend_try { |
zend_try { |
zend_bool send_buffer = SG(request_info).headers_only ? 0 : 1; |
zend_bool send_buffer = SG(request_info).headers_only ? 0 : 1; |
|
|
if (CG(unclean_shutdown) && PG(last_error_type) == E_ERROR && |
if (CG(unclean_shutdown) && PG(last_error_type) == E_ERROR && |
OG(ob_nesting_level) && !OG(active_ob_buffer).chunk_size && PG(memory_limit) < zend_memory_usage(1 TSRMLS_CC)) { | (size_t)PG(memory_limit) < zend_memory_usage(1 TSRMLS_CC) |
| ) { |
send_buffer = 0; |
send_buffer = 0; |
} |
} |
php_end_ob_buffers(send_buffer TSRMLS_CC); | |
| if (!send_buffer) { |
| php_output_discard_all(TSRMLS_C); |
| } else { |
| php_output_end_all(TSRMLS_C); |
| } |
} zend_end_try(); |
} zend_end_try(); |
|
|
/* 4. Send the set HTTP headers (note: This must be done AFTER php_end_ob_buffers() !!) */ | /* 4. Reset max_execution_time (no longer executing php code after response sent) */ |
zend_try { |
zend_try { |
sapi_send_headers(TSRMLS_C); | zend_unset_timeout(TSRMLS_C); |
} zend_end_try(); |
} zend_end_try(); |
|
|
/* 5. Call all extensions RSHUTDOWN functions */ |
/* 5. Call all extensions RSHUTDOWN functions */ |
Line 1639 void php_request_shutdown(void *dummy)
|
Line 1778 void php_request_shutdown(void *dummy)
|
php_free_shutdown_functions(TSRMLS_C); |
php_free_shutdown_functions(TSRMLS_C); |
} |
} |
|
|
/* 6. Destroy super-globals */ | /* 6. Shutdown output layer (send the set HTTP headers, cleanup output handlers, etc.) */ |
zend_try { |
zend_try { |
|
php_output_deactivate(TSRMLS_C); |
|
} zend_end_try(); |
|
|
|
/* 7. Destroy super-globals */ |
|
zend_try { |
int i; |
int i; |
|
|
for (i=0; i<NUM_TRACK_VARS; i++) { |
for (i=0; i<NUM_TRACK_VARS; i++) { |
Line 1650 void php_request_shutdown(void *dummy)
|
Line 1794 void php_request_shutdown(void *dummy)
|
} |
} |
} zend_end_try(); |
} zend_end_try(); |
|
|
/* 6.5 free last error information */ | /* 7.5 free last error information */ |
if (PG(last_error_message)) { |
if (PG(last_error_message)) { |
free(PG(last_error_message)); |
free(PG(last_error_message)); |
PG(last_error_message) = NULL; |
PG(last_error_message) = NULL; |
Line 1682 void php_request_shutdown(void *dummy)
|
Line 1826 void php_request_shutdown(void *dummy)
|
zend_try { |
zend_try { |
shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC); |
shutdown_memory_manager(CG(unclean_shutdown) || !report_memleaks, 0 TSRMLS_CC); |
} zend_end_try(); |
} zend_end_try(); |
|
zend_interned_strings_restore(TSRMLS_C); |
|
|
/* 12. Reset max_execution_time */ |
/* 12. Reset max_execution_time */ |
zend_try { |
zend_try { |
Line 1694 void php_request_shutdown(void *dummy)
|
Line 1839 void php_request_shutdown(void *dummy)
|
PG(com_initialized) = 0; |
PG(com_initialized) = 0; |
} |
} |
#endif |
#endif |
|
|
|
#ifdef HAVE_DTRACE |
|
DTRACE_REQUEST_SHUTDOWN(SAFE_FILENAME(SG(request_info).path_translated), SAFE_FILENAME(SG(request_info).request_uri), (char *)SAFE_FILENAME(SG(request_info).request_method)); |
|
#endif /* HAVE_DTRACE */ |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 1711 PHPAPI void php_com_initialize(TSRMLS_D)
|
Line 1860 PHPAPI void php_com_initialize(TSRMLS_D)
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
/* {{{ php_body_write_wrapper | /* {{{ php_output_wrapper |
*/ |
*/ |
static int php_body_write_wrapper(const char *str, uint str_length) | static int php_output_wrapper(const char *str, uint str_length) |
{ |
{ |
TSRMLS_FETCH(); |
TSRMLS_FETCH(); |
return php_body_write(str, str_length TSRMLS_CC); | return php_output_write(str, str_length TSRMLS_CC); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 1748 static void core_globals_dtor(php_core_globals *core_g
|
Line 1897 static void core_globals_dtor(php_core_globals *core_g
|
if (core_globals->disable_classes) { |
if (core_globals->disable_classes) { |
free(core_globals->disable_classes); |
free(core_globals->disable_classes); |
} |
} |
|
if (core_globals->php_binary) { |
|
free(core_globals->php_binary); |
|
} |
|
|
php_shutdown_ticks(TSRMLS_C); |
php_shutdown_ticks(TSRMLS_C); |
} |
} |
Line 1756 static void core_globals_dtor(php_core_globals *core_g
|
Line 1908 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 1779 int php_register_extensions(zend_module_entry **ptr, i
|
Line 1931 int php_register_extensions(zend_module_entry **ptr, i
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
#if defined(PHP_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1400) | #if defined(PHP_WIN32) && _MSC_VER >= 1400 |
static _invalid_parameter_handler old_invalid_parameter_handler; |
static _invalid_parameter_handler old_invalid_parameter_handler; |
|
|
void dummy_invalid_parameter_handler( |
void dummy_invalid_parameter_handler( |
Line 1813 void dummy_invalid_parameter_handler(
|
Line 1965 void dummy_invalid_parameter_handler(
|
} |
} |
#endif |
#endif |
|
|
#if SUHOSIN_PATCH |
|
PHPAPI void suhosin_startup(); |
|
#endif |
|
|
|
/* {{{ php_module_startup |
/* {{{ php_module_startup |
*/ |
*/ |
int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules) |
int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules) |
{ |
{ |
zend_utility_functions zuf; |
zend_utility_functions zuf; |
zend_utility_values zuv; |
zend_utility_values zuv; |
int module_number=0; /* for REGISTER_INI_ENTRIES() */ | int retval = SUCCESS, module_number=0; /* for REGISTER_INI_ENTRIES() */ |
char *php_os; |
char *php_os; |
zend_module_entry *module; |
zend_module_entry *module; |
#ifdef ZTS |
#ifdef ZTS |
Line 1831 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 1979 int php_module_startup(sapi_module_struct *sf, zend_mo
|
void ***tsrm_ls; |
void ***tsrm_ls; |
php_core_globals *core_globals; |
php_core_globals *core_globals; |
#endif |
#endif |
|
|
#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK)) |
#if defined(PHP_WIN32) || (defined(NETWARE) && defined(USE_WINSOCK)) |
WORD wVersionRequested = MAKEWORD(2, 0); |
WORD wVersionRequested = MAKEWORD(2, 0); |
WSADATA wsaData; |
WSADATA wsaData; |
#endif |
#endif |
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
DWORD dwVersion = GetVersion(); | php_os = "WINNT"; |
/* Get build numbers for Windows NT or Win95 */ | #if _MSC_VER >= 1400 |
if (dwVersion < 0x80000000){ | |
php_os="WINNT"; | |
} else { | |
php_os="WIN32"; | |
} | |
#if defined(_MSC_VER) && (_MSC_VER >= 1400) | |
old_invalid_parameter_handler = |
old_invalid_parameter_handler = |
_set_invalid_parameter_handler(dummy_invalid_parameter_handler); |
_set_invalid_parameter_handler(dummy_invalid_parameter_handler); |
if (old_invalid_parameter_handler != NULL) { |
if (old_invalid_parameter_handler != NULL) { |
Line 1865 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2008 int php_module_startup(sapi_module_struct *sf, zend_mo
|
php_win32_init_rng_lock(); |
php_win32_init_rng_lock(); |
#endif |
#endif |
|
|
#if SUHOSIN_PATCH |
|
suhosin_startup(); |
|
#endif |
|
|
|
module_shutdown = 0; |
module_shutdown = 0; |
module_startup = 1; |
module_startup = 1; |
sapi_initialize_empty_request(TSRMLS_C); |
sapi_initialize_empty_request(TSRMLS_C); |
Line 1884 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2023 int php_module_startup(sapi_module_struct *sf, zend_mo
|
|
|
zuf.error_function = php_error_cb; |
zuf.error_function = php_error_cb; |
zuf.printf_function = php_printf; |
zuf.printf_function = php_printf; |
zuf.write_function = php_body_write_wrapper; | zuf.write_function = php_output_wrapper; |
zuf.fopen_function = php_fopen_wrapper_for_zend; |
zuf.fopen_function = php_fopen_wrapper_for_zend; |
zuf.message_handler = php_message_handler_for_zend; |
zuf.message_handler = php_message_handler_for_zend; |
zuf.block_interruptions = sapi_module.block_interruptions; |
zuf.block_interruptions = sapi_module.block_interruptions; |
Line 1939 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2078 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 1991 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2132 int php_module_startup(sapi_module_struct *sf, zend_mo
|
REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_STRINGL_CONSTANT("PHP_CONFIG_FILE_SCAN_DIR", PHP_CONFIG_FILE_SCAN_DIR, sizeof(PHP_CONFIG_FILE_SCAN_DIR)-1, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_STRINGL_CONSTANT("PHP_SHLIB_SUFFIX", PHP_SHLIB_SUFFIX, sizeof(PHP_SHLIB_SUFFIX)-1, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_STRINGL_CONSTANT("PHP_EOL", PHP_EOL, sizeof(PHP_EOL)-1, CONST_PERSISTENT | CONST_CS); |
#if SUHOSIN_PATCH | REGISTER_MAIN_LONG_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_LONG_CONSTANT("SUHOSIN_PATCH", 1, CONST_PERSISTENT | CONST_CS); | |
REGISTER_MAIN_STRINGL_CONSTANT("SUHOSIN_PATCH_VERSION", SUHOSIN_PATCH_VERSION, sizeof(SUHOSIN_PATCH_VERSION)-1, CONST_PERSISTENT | CONST_CS); | |
#endif | |
REGISTER_MAIN_LONG_CONSTANT("PHP_MAXPATHLEN", MAXPATHLEN, CONST_PERSISTENT | CONST_CS); | |
REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS); |
#ifdef ZEND_MULTIBYTE |
|
REGISTER_MAIN_LONG_CONSTANT("ZEND_MULTIBYTE", 1, CONST_PERSISTENT | CONST_CS); |
|
#else |
|
REGISTER_MAIN_LONG_CONSTANT("ZEND_MULTIBYTE", 0, CONST_PERSISTENT | CONST_CS); |
|
#endif |
|
|
|
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_VERSION_MAJOR", EG(windows_version_info).dwMajorVersion, CONST_PERSISTENT | CONST_CS); |
Line 2018 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2150 int php_module_startup(sapi_module_struct *sf, zend_mo
|
REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS); |
REGISTER_MAIN_LONG_CONSTANT("PHP_WINDOWS_NT_WORKSTATION", VER_NT_WORKSTATION, CONST_PERSISTENT | CONST_CS); |
#endif |
#endif |
|
|
|
php_binary_init(TSRMLS_C); |
|
if (PG(php_binary)) { |
|
REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINARY", PG(php_binary), strlen(PG(php_binary)), CONST_PERSISTENT | CONST_CS); |
|
} else { |
|
REGISTER_MAIN_STRINGL_CONSTANT("PHP_BINARY", "", 0, CONST_PERSISTENT | CONST_CS); |
|
} |
|
|
php_output_register_constants(TSRMLS_C); |
php_output_register_constants(TSRMLS_C); |
php_rfc1867_register_constants(TSRMLS_C); |
php_rfc1867_register_constants(TSRMLS_C); |
|
|
Line 2034 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2173 int php_module_startup(sapi_module_struct *sf, zend_mo
|
/* Register Zend ini entries */ |
/* Register Zend ini entries */ |
zend_register_standard_ini_entries(TSRMLS_C); |
zend_register_standard_ini_entries(TSRMLS_C); |
|
|
/* Disable realpath cache if safe_mode or open_basedir are set */ | /* Disable realpath cache if an open_basedir is set */ |
if (PG(safe_mode) || (PG(open_basedir) && *PG(open_basedir))) { | if (PG(open_basedir) && *PG(open_basedir)) { |
CWDG(realpath_cache_size_limit) = 0; |
CWDG(realpath_cache_size_limit) = 0; |
} |
} |
|
|
Line 2047 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2186 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 2083 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2222 int php_module_startup(sapi_module_struct *sf, zend_mo
|
/* start Zend extensions */ |
/* start Zend extensions */ |
zend_startup_extensions(); |
zend_startup_extensions(); |
|
|
|
zend_collect_module_handlers(TSRMLS_C); |
|
|
/* register additional functions */ |
/* register additional functions */ |
if (sapi_module.additional_functions) { |
if (sapi_module.additional_functions) { |
if (zend_hash_find(&module_registry, "standard", sizeof("standard"), (void**)&module)==SUCCESS) { |
if (zend_hash_find(&module_registry, "standard", sizeof("standard"), (void**)&module)==SUCCESS) { |
Line 2091 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2232 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 2105 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2246 int php_module_startup(sapi_module_struct *sf, zend_mo
|
|
|
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
/* Disable incompatible functions for the running platform */ |
/* Disable incompatible functions for the running platform */ |
if (php_win32_disable_functions() == FAILURE) { | if (php_win32_disable_functions(TSRMLS_C) == FAILURE) { |
php_printf("Unable to disable unsupported functions\n"); |
php_printf("Unable to disable unsupported functions\n"); |
return FAILURE; |
return FAILURE; |
} |
} |
Line 2118 int php_module_startup(sapi_module_struct *sf, zend_mo
|
Line 2259 int php_module_startup(sapi_module_struct *sf, zend_mo
|
module_initialized = 1; |
module_initialized = 1; |
|
|
/* Check for deprecated directives */ |
/* Check for deprecated directives */ |
/* NOTE: If you add anything here, remember to add it also in Makefile.global! */ | /* NOTE: If you add anything here, remember to add it to Makefile.global! */ |
{ |
{ |
static const char *directives[] = { | struct { |
"define_syslog_variables", | const long error_level; |
"register_globals", | const char *phrase; |
"register_long_arrays", | const char *directives[16]; /* Remember to change this if the number of directives change */ |
"safe_mode", | } directives[2] = { |
"magic_quotes_gpc", | { |
"magic_quotes_runtime", | E_DEPRECATED, |
"magic_quotes_sybase", | "Directive '%s' is deprecated in PHP 5.3 and greater", |
NULL | { |
| NULL |
| } |
| }, |
| { |
| E_CORE_ERROR, |
| "Directive '%s' is no longer available in PHP", |
| { |
| "allow_call_time_pass_reference", |
| "define_syslog_variables", |
| "highlight.bg", |
| "magic_quotes_gpc", |
| "magic_quotes_runtime", |
| "magic_quotes_sybase", |
| "register_globals", |
| "register_long_arrays", |
| "safe_mode", |
| "safe_mode_gid", |
| "safe_mode_include_dir", |
| "safe_mode_exec_dir", |
| "safe_mode_allowed_env_vars", |
| "safe_mode_protected_env_vars", |
| "zend.ze1_compatibility_mode", |
| NULL |
| } |
| } |
}; |
}; |
const char **p = directives; |
|
long val; |
|
|
|
while (*p) { | unsigned int i; |
if (cfg_get_long((char*)*p, &val) == SUCCESS && val) { | |
zend_error(E_DEPRECATED, "Directive '%s' is deprecated in PHP 5.3 and greater", *p); | |
} | |
++p; | |
} | |
|
|
/* This is not too nice, but since its the only one theres no need for extra stuff here */ | zend_try { |
if (cfg_get_long("zend.ze1_compatibility_mode", &val) == SUCCESS && val) { | /* 2 = Count of deprecation structs */ |
zend_error(E_CORE_ERROR, "zend.ze1_compatibility_mode is no longer supported in PHP 5.3 and greater"); | for (i = 0; i < 2; i++) { |
} | const char **p = directives[i].directives; |
| |
| while(*p) { |
| long value; |
| |
| if (cfg_get_long((char*)*p, &value) == SUCCESS && value) { |
| zend_error(directives[i].error_level, directives[i].phrase, *p); |
| } |
| |
| ++p; |
| } |
| } |
| } zend_catch { |
| retval = FAILURE; |
| } zend_end_try(); |
} |
} |
| |
sapi_deactivate(TSRMLS_C); |
sapi_deactivate(TSRMLS_C); |
module_startup = 0; |
module_startup = 0; |
|
|
shutdown_memory_manager(1, 0 TSRMLS_CC); |
shutdown_memory_manager(1, 0 TSRMLS_CC); |
|
zend_interned_strings_snapshot(TSRMLS_C); |
|
|
/* we're done */ |
/* we're done */ |
return SUCCESS; | return retval; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 2199 void php_module_shutdown(TSRMLS_D)
|
Line 2373 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 2212 void php_module_shutdown(TSRMLS_D)
|
Line 2386 void php_module_shutdown(TSRMLS_D)
|
#ifndef ZTS |
#ifndef ZTS |
zend_ini_shutdown(TSRMLS_C); |
zend_ini_shutdown(TSRMLS_C); |
shutdown_memory_manager(CG(unclean_shutdown), 1 TSRMLS_CC); |
shutdown_memory_manager(CG(unclean_shutdown), 1 TSRMLS_CC); |
core_globals_dtor(&core_globals TSRMLS_CC); |
|
gc_globals_dtor(TSRMLS_C); |
|
#else |
#else |
zend_ini_global_shutdown(TSRMLS_C); |
zend_ini_global_shutdown(TSRMLS_C); |
ts_free_id(core_globals_id); |
|
#endif |
#endif |
|
|
|
php_output_shutdown(); |
php_shutdown_temporary_directory(); |
php_shutdown_temporary_directory(); |
|
|
module_initialized = 0; |
module_initialized = 0; |
|
|
|
#ifndef ZTS |
|
core_globals_dtor(&core_globals TSRMLS_CC); |
|
gc_globals_dtor(TSRMLS_C); |
|
#else |
|
ts_free_id(core_globals_id); |
|
#endif |
|
|
#if defined(PHP_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1400) |
#if defined(PHP_WIN32) && defined(_MSC_VER) && (_MSC_VER >= 1400) |
if (old_invalid_parameter_handler == NULL) { |
if (old_invalid_parameter_handler == NULL) { |
_set_invalid_parameter_handler(old_invalid_parameter_handler); |
_set_invalid_parameter_handler(old_invalid_parameter_handler); |
Line 2238 PHPAPI int php_execute_script(zend_file_handle *primar
|
Line 2417 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) |
Line 2272 PHPAPI int php_execute_script(zend_file_handle *primar
|
Line 2451 PHPAPI int php_execute_script(zend_file_handle *primar
|
/* this looks nasty to me */ |
/* this looks nasty to me */ |
old_cwd_fd = open(".", 0); |
old_cwd_fd = open(".", 0); |
#else |
#else |
VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1); | php_ignore_value(VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1)); |
#endif |
#endif |
VCWD_CHDIR_FILE(primary_file->filename); |
VCWD_CHDIR_FILE(primary_file->filename); |
} |
} |
Line 2331 PHPAPI int php_execute_script(zend_file_handle *primar
|
Line 2510 PHPAPI int php_execute_script(zend_file_handle *primar
|
} |
} |
#else |
#else |
if (old_cwd[0] != '\0') { |
if (old_cwd[0] != '\0') { |
VCWD_CHDIR(old_cwd); | php_ignore_value(VCWD_CHDIR(old_cwd)); |
} |
} |
free_alloca(old_cwd, use_heap); |
free_alloca(old_cwd, use_heap); |
#endif |
#endif |
Line 2361 PHPAPI int php_execute_simple_script(zend_file_handle
|
Line 2540 PHPAPI int php_execute_simple_script(zend_file_handle
|
PG(during_request_startup) = 0; |
PG(during_request_startup) = 0; |
|
|
if (primary_file->filename && !(SG(options) & SAPI_OPTION_NO_CHDIR)) { |
if (primary_file->filename && !(SG(options) & SAPI_OPTION_NO_CHDIR)) { |
VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1); | php_ignore_value(VCWD_GETCWD(old_cwd, OLD_CWD_SIZE-1)); |
VCWD_CHDIR_FILE(primary_file->filename); |
VCWD_CHDIR_FILE(primary_file->filename); |
} |
} |
zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, ret, 1, primary_file); |
zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, ret, 1, primary_file); |
} zend_end_try(); |
} zend_end_try(); |
|
|
if (old_cwd[0] != '\0') { |
if (old_cwd[0] != '\0') { |
VCWD_CHDIR(old_cwd); | php_ignore_value(VCWD_CHDIR(old_cwd)); |
} |
} |
|
|
free_alloca(old_cwd, use_heap); |
free_alloca(old_cwd, use_heap); |
Line 2383 PHPAPI void php_handle_aborted_connection(void)
|
Line 2562 PHPAPI void php_handle_aborted_connection(void)
|
TSRMLS_FETCH(); |
TSRMLS_FETCH(); |
|
|
PG(connection_status) = PHP_CONNECTION_ABORTED; |
PG(connection_status) = PHP_CONNECTION_ABORTED; |
php_output_set_status(0 TSRMLS_CC); | php_output_set_status(PHP_OUTPUT_DISABLED TSRMLS_CC); |
|
|
if (!PG(ignore_user_abort)) { |
if (!PG(ignore_user_abort)) { |
zend_bailout(); |
zend_bailout(); |