version 1.1.1.1, 2012/02/21 23:48:02
|
version 1.1.1.2, 2012/05/29 12:34:43
|
Line 34
|
Line 34
|
#include "zend_operators.h" |
#include "zend_operators.h" |
#include "ext/standard/php_dns.h" |
#include "ext/standard/php_dns.h" |
#include "ext/standard/php_uuencode.h" |
#include "ext/standard/php_uuencode.h" |
#include "safe_mode.h" |
|
|
|
#ifdef PHP_WIN32 |
#ifdef PHP_WIN32 |
#include "win32/php_win32_globals.h" |
#include "win32/php_win32_globals.h" |
Line 119 PHPAPI php_basic_globals basic_globals;
|
Line 118 PHPAPI php_basic_globals basic_globals;
|
|
|
static zend_class_entry *incomplete_class_entry = NULL; |
static zend_class_entry *incomplete_class_entry = NULL; |
|
|
typedef struct _php_shutdown_function_entry { |
|
zval **arguments; |
|
int arg_count; |
|
} php_shutdown_function_entry; |
|
|
|
typedef struct _user_tick_function_entry { |
typedef struct _user_tick_function_entry { |
zval **arguments; |
zval **arguments; |
int arg_count; |
int arg_count; |
Line 142 ZEND_BEGIN_ARG_INFO(arginfo_set_time_limit, 0)
|
Line 136 ZEND_BEGIN_ARG_INFO(arginfo_set_time_limit, 0)
|
ZEND_ARG_INFO(0, seconds) |
ZEND_ARG_INFO(0, seconds) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
/* }}} */ |
/* }}} */ |
|
|
|
/* {{{ main/sapi.c */ |
|
ZEND_BEGIN_ARG_INFO(arginfo_header_register_callback, 0) |
|
ZEND_ARG_INFO(0, callback) |
|
ZEND_END_ARG_INFO() |
|
/* }}} */ |
|
|
/* {{{ main/output.c */ |
/* {{{ main/output.c */ |
ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_start, 0, 0, 0) |
ZEND_BEGIN_ARG_INFO_EX(arginfo_ob_start, 0, 0, 0) |
ZEND_ARG_INFO(0, user_function) |
ZEND_ARG_INFO(0, user_function) |
Line 855 ZEND_END_ARG_INFO()
|
Line 856 ZEND_END_ARG_INFO()
|
ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0) |
ZEND_BEGIN_ARG_INFO(arginfo_config_get_hash, 0) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
#endif |
#endif |
|
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_import_request_variables, 0, 0, 1) |
|
ZEND_ARG_INFO(0, types) |
|
ZEND_ARG_INFO(0, prefix) |
|
ZEND_END_ARG_INFO() |
|
|
|
#ifdef HAVE_GETLOADAVG |
#ifdef HAVE_GETLOADAVG |
ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0) |
ZEND_BEGIN_ARG_INFO(arginfo_sys_getloadavg, 0) |
Line 1002 ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0,
|
Line 998 ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_check_record, 0, 0,
|
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
|
|
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS |
# if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS |
ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_record, 1, 0, 1) | ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_record, 0, 0, 1) |
ZEND_ARG_INFO(0, hostname) |
ZEND_ARG_INFO(0, hostname) |
ZEND_ARG_INFO(0, type) |
ZEND_ARG_INFO(0, type) |
ZEND_ARG_INFO(1, authns) /* ARRAY_INFO(1, authns, 1) */ | ZEND_ARG_ARRAY_INFO(1, authns, 1) |
ZEND_ARG_INFO(1, addtl) /* ARRAY_INFO(1, addtl, 1) */ | ZEND_ARG_ARRAY_INFO(1, addtl, 1) |
| ZEND_ARG_INFO(0, raw) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
|
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_mx, 0, 0, 2) |
ZEND_BEGIN_ARG_INFO_EX(arginfo_dns_get_mx, 0, 0, 2) |
Line 1209 ZEND_END_ARG_INFO()
|
Line 1206 ZEND_END_ARG_INFO()
|
ZEND_BEGIN_ARG_INFO(arginfo_fstat, 0) |
ZEND_BEGIN_ARG_INFO(arginfo_fstat, 0) |
ZEND_ARG_INFO(0, fp) |
ZEND_ARG_INFO(0, fp) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
| ZEND_BEGIN_ARG_INFO(arginfo_copy, 0) |
ZEND_BEGIN_ARG_INFO_EX(arginfo_copy, 0, 0, 2) | |
ZEND_ARG_INFO(0, source_file) |
ZEND_ARG_INFO(0, source_file) |
ZEND_ARG_INFO(0, destination_file) |
ZEND_ARG_INFO(0, destination_file) |
ZEND_ARG_INFO(0, context) |
ZEND_ARG_INFO(0, context) |
Line 1479 ZEND_END_ARG_INFO()
|
Line 1475 ZEND_END_ARG_INFO()
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0) |
ZEND_BEGIN_ARG_INFO(arginfo_headers_list, 0) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
|
|
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_http_response_code, 0, 0, 0) |
|
ZEND_ARG_INFO(0, response_code) |
|
ZEND_END_ARG_INFO() |
/* }}} */ |
/* }}} */ |
/* {{{ html.c */ |
/* {{{ html.c */ |
ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1) |
ZEND_BEGIN_ARG_INFO_EX(arginfo_htmlspecialchars, 0, 0, 1) |
Line 1517 ZEND_BEGIN_ARG_INFO_EX(arginfo_http_build_query, 0, 0,
|
Line 1517 ZEND_BEGIN_ARG_INFO_EX(arginfo_http_build_query, 0, 0,
|
ZEND_ARG_INFO(0, formdata) |
ZEND_ARG_INFO(0, formdata) |
ZEND_ARG_INFO(0, prefix) |
ZEND_ARG_INFO(0, prefix) |
ZEND_ARG_INFO(0, arg_separator) |
ZEND_ARG_INFO(0, arg_separator) |
|
ZEND_ARG_INFO(0, enc_type) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
/* }}} */ |
/* }}} */ |
/* {{{ image.c */ |
/* {{{ image.c */ |
Line 2112 ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0
|
Line 2113 ZEND_BEGIN_ARG_INFO(arginfo_stream_set_write_buffer, 0
|
ZEND_ARG_INFO(0, fp) |
ZEND_ARG_INFO(0, fp) |
ZEND_ARG_INFO(0, buffer) |
ZEND_ARG_INFO(0, buffer) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_stream_set_chunk_size, 0) |
|
ZEND_ARG_INFO(0, fp) |
|
ZEND_ARG_INFO(0, chunk_size) |
|
ZEND_END_ARG_INFO() |
|
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_enable_crypto, 0, 0, 2) |
ZEND_BEGIN_ARG_INFO_EX(arginfo_stream_socket_enable_crypto, 0, 0, 2) |
ZEND_ARG_INFO(0, stream) |
ZEND_ARG_INFO(0, stream) |
Line 2132 ZEND_BEGIN_ARG_INFO(arginfo_bin2hex, 0)
|
Line 2138 ZEND_BEGIN_ARG_INFO(arginfo_bin2hex, 0)
|
ZEND_ARG_INFO(0, data) |
ZEND_ARG_INFO(0, data) |
ZEND_END_ARG_INFO() |
ZEND_END_ARG_INFO() |
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_hex2bin, 0) |
|
ZEND_ARG_INFO(0, data) |
|
ZEND_END_ARG_INFO() |
|
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_strspn, 0, 0, 2) |
ZEND_BEGIN_ARG_INFO_EX(arginfo_strspn, 0, 0, 2) |
ZEND_ARG_INFO(0, str) |
ZEND_ARG_INFO(0, str) |
ZEND_ARG_INFO(0, mask) |
ZEND_ARG_INFO(0, mask) |
Line 2472 ZEND_END_ARG_INFO()
|
Line 2482 ZEND_END_ARG_INFO()
|
/* }}} */ |
/* }}} */ |
/* {{{ syslog.c */ |
/* {{{ syslog.c */ |
#ifdef HAVE_SYSLOG_H |
#ifdef HAVE_SYSLOG_H |
ZEND_BEGIN_ARG_INFO(arginfo_define_syslog_variables, 0) |
|
ZEND_END_ARG_INFO() |
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_openlog, 0) |
ZEND_BEGIN_ARG_INFO(arginfo_openlog, 0) |
ZEND_ARG_INFO(0, ident) |
ZEND_ARG_INFO(0, ident) |
ZEND_ARG_INFO(0, option) |
ZEND_ARG_INFO(0, option) |
Line 2675 ZEND_END_ARG_INFO()
|
Line 2682 ZEND_END_ARG_INFO()
|
const zend_function_entry basic_functions[] = { /* {{{ */ |
const zend_function_entry basic_functions[] = { /* {{{ */ |
PHP_FE(constant, arginfo_constant) |
PHP_FE(constant, arginfo_constant) |
PHP_FE(bin2hex, arginfo_bin2hex) |
PHP_FE(bin2hex, arginfo_bin2hex) |
|
PHP_FE(hex2bin, arginfo_hex2bin) |
PHP_FE(sleep, arginfo_sleep) |
PHP_FE(sleep, arginfo_sleep) |
PHP_FE(usleep, arginfo_usleep) |
PHP_FE(usleep, arginfo_usleep) |
#if HAVE_NANOSLEEP |
#if HAVE_NANOSLEEP |
Line 2702 const zend_function_entry basic_functions[] = { /* {{{
|
Line 2710 const zend_function_entry basic_functions[] = { /* {{{
|
PHP_FE(iptcparse, arginfo_iptcparse) |
PHP_FE(iptcparse, arginfo_iptcparse) |
PHP_FE(iptcembed, arginfo_iptcembed) |
PHP_FE(iptcembed, arginfo_iptcembed) |
PHP_FE(getimagesize, arginfo_getimagesize) |
PHP_FE(getimagesize, arginfo_getimagesize) |
|
PHP_FE(getimagesizefromstring, arginfo_getimagesize) |
PHP_FE(image_type_to_mime_type, arginfo_image_type_to_mime_type) |
PHP_FE(image_type_to_mime_type, arginfo_image_type_to_mime_type) |
PHP_FE(image_type_to_extension, arginfo_image_type_to_extension) |
PHP_FE(image_type_to_extension, arginfo_image_type_to_extension) |
|
|
Line 2835 const zend_function_entry basic_functions[] = { /* {{{
|
Line 2844 const zend_function_entry basic_functions[] = { /* {{{
|
|
|
PHP_FE(rand, arginfo_rand) |
PHP_FE(rand, arginfo_rand) |
PHP_FE(srand, arginfo_srand) |
PHP_FE(srand, arginfo_srand) |
PHP_FE(getrandmax, arginfo_getrandmax) | PHP_FE(getrandmax, arginfo_getrandmax) |
PHP_FE(mt_rand, arginfo_mt_rand) | PHP_FE(mt_rand, arginfo_mt_rand) |
PHP_FE(mt_srand, arginfo_mt_srand) |
PHP_FE(mt_srand, arginfo_mt_srand) |
PHP_FE(mt_getrandmax, arginfo_mt_getrandmax) |
PHP_FE(mt_getrandmax, arginfo_mt_getrandmax) |
|
|
Line 2945 const zend_function_entry basic_functions[] = { /* {{{
|
Line 2954 const zend_function_entry basic_functions[] = { /* {{{
|
PHP_FE(convert_cyr_string, arginfo_convert_cyr_string) |
PHP_FE(convert_cyr_string, arginfo_convert_cyr_string) |
PHP_FE(get_current_user, arginfo_get_current_user) |
PHP_FE(get_current_user, arginfo_get_current_user) |
PHP_FE(set_time_limit, arginfo_set_time_limit) |
PHP_FE(set_time_limit, arginfo_set_time_limit) |
|
PHP_FE(header_register_callback, arginfo_header_register_callback) |
PHP_FE(get_cfg_var, arginfo_get_cfg_var) |
PHP_FE(get_cfg_var, arginfo_get_cfg_var) |
|
|
PHP_DEP_FALIAS(magic_quotes_runtime, set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime) |
PHP_DEP_FALIAS(magic_quotes_runtime, set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime) |
PHP_DEP_FE(set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime) |
PHP_DEP_FE(set_magic_quotes_runtime, arginfo_set_magic_quotes_runtime) |
PHP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc) | PHP_FE(get_magic_quotes_gpc, arginfo_get_magic_quotes_gpc) |
PHP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime) | PHP_FE(get_magic_quotes_runtime, arginfo_get_magic_quotes_runtime) |
|
|
PHP_FE(import_request_variables, arginfo_import_request_variables) |
|
PHP_FE(error_log, arginfo_error_log) |
PHP_FE(error_log, arginfo_error_log) |
PHP_FE(error_get_last, arginfo_error_get_last) |
PHP_FE(error_get_last, arginfo_error_get_last) |
PHP_FE(call_user_func, arginfo_call_user_func) |
PHP_FE(call_user_func, arginfo_call_user_func) |
Line 2995 const zend_function_entry basic_functions[] = { /* {{{
|
Line 3004 const zend_function_entry basic_functions[] = { /* {{{
|
PHP_FE(header_remove, arginfo_header_remove) |
PHP_FE(header_remove, arginfo_header_remove) |
PHP_FE(headers_sent, arginfo_headers_sent) |
PHP_FE(headers_sent, arginfo_headers_sent) |
PHP_FE(headers_list, arginfo_headers_list) |
PHP_FE(headers_list, arginfo_headers_list) |
|
PHP_FE(http_response_code, arginfo_http_response_code) |
|
|
PHP_FE(connection_aborted, arginfo_connection_aborted) |
PHP_FE(connection_aborted, arginfo_connection_aborted) |
PHP_FE(connection_status, arginfo_connection_status) |
PHP_FE(connection_status, arginfo_connection_status) |
Line 3115 const zend_function_entry basic_functions[] = { /* {{{
|
Line 3125 const zend_function_entry basic_functions[] = { /* {{{
|
PHP_FE(stream_set_read_buffer, arginfo_stream_set_read_buffer) |
PHP_FE(stream_set_read_buffer, arginfo_stream_set_read_buffer) |
PHP_FE(stream_set_write_buffer, arginfo_stream_set_write_buffer) |
PHP_FE(stream_set_write_buffer, arginfo_stream_set_write_buffer) |
PHP_FALIAS(set_file_buffer, stream_set_write_buffer, arginfo_stream_set_write_buffer) |
PHP_FALIAS(set_file_buffer, stream_set_write_buffer, arginfo_stream_set_write_buffer) |
|
PHP_FE(stream_set_chunk_size, arginfo_stream_set_chunk_size) |
|
|
PHP_DEP_FALIAS(set_socket_blocking, stream_set_blocking, arginfo_stream_set_blocking) |
PHP_DEP_FALIAS(set_socket_blocking, stream_set_blocking, arginfo_stream_set_blocking) |
PHP_FE(stream_set_blocking, arginfo_stream_set_blocking) |
PHP_FE(stream_set_blocking, arginfo_stream_set_blocking) |
Line 3230 const zend_function_entry basic_functions[] = { /* {{{
|
Line 3241 const zend_function_entry basic_functions[] = { /* {{{
|
PHP_FE(openlog, arginfo_openlog) |
PHP_FE(openlog, arginfo_openlog) |
PHP_FE(syslog, arginfo_syslog) |
PHP_FE(syslog, arginfo_syslog) |
PHP_FE(closelog, arginfo_closelog) |
PHP_FE(closelog, arginfo_closelog) |
PHP_DEP_FE(define_syslog_variables, arginfo_define_syslog_variables) |
|
#endif |
#endif |
|
|
/* functions from lcg.c */ |
/* functions from lcg.c */ |
Line 3364 const zend_function_entry basic_functions[] = { /* {{{
|
Line 3374 const zend_function_entry basic_functions[] = { /* {{{
|
}; |
}; |
/* }}} */ |
/* }}} */ |
|
|
static PHP_INI_MH(OnUpdateSafeModeProtectedEnvVars) /* {{{ */ |
|
{ |
|
char *protected_vars, *protected_var; |
|
char *token_buf; |
|
int dummy = 1; |
|
|
|
protected_vars = estrndup(new_value, new_value_length); |
|
zend_hash_clean(&BG(sm_protected_env_vars)); |
|
|
|
protected_var = php_strtok_r(protected_vars, ", ", &token_buf); |
|
while (protected_var) { |
|
zend_hash_update(&BG(sm_protected_env_vars), protected_var, strlen(protected_var), &dummy, sizeof(int), NULL); |
|
protected_var = php_strtok_r(NULL, ", ", &token_buf); |
|
} |
|
efree(protected_vars); |
|
return SUCCESS; |
|
} |
|
/* }}} */ |
|
|
|
static PHP_INI_MH(OnUpdateSafeModeAllowedEnvVars) /* {{{ */ |
|
{ |
|
if (BG(sm_allowed_env_vars)) { |
|
free(BG(sm_allowed_env_vars)); |
|
} |
|
BG(sm_allowed_env_vars) = zend_strndup(new_value, new_value_length); |
|
return SUCCESS; |
|
} |
|
/* }}} */ |
|
|
|
PHP_INI_BEGIN() /* {{{ */ |
|
PHP_INI_ENTRY_EX("safe_mode_protected_env_vars", SAFE_MODE_PROTECTED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeProtectedEnvVars, NULL) |
|
PHP_INI_ENTRY_EX("safe_mode_allowed_env_vars", SAFE_MODE_ALLOWED_ENV_VARS, PHP_INI_SYSTEM, OnUpdateSafeModeAllowedEnvVars, NULL) |
|
PHP_INI_END() |
|
/* }}} */ |
|
|
|
static const zend_module_dep standard_deps[] = { /* {{{ */ |
static const zend_module_dep standard_deps[] = { /* {{{ */ |
ZEND_MOD_OPTIONAL("session") |
ZEND_MOD_OPTIONAL("session") |
ZEND_MOD_END |
ZEND_MOD_END |
Line 3475 static void basic_globals_ctor(php_basic_globals *basi
|
Line 3450 static void basic_globals_ctor(php_basic_globals *basi
|
BG(left) = -1; |
BG(left) = -1; |
BG(user_tick_functions) = NULL; |
BG(user_tick_functions) = NULL; |
BG(user_filter_map) = NULL; |
BG(user_filter_map) = NULL; |
zend_hash_init(&BG(sm_protected_env_vars), 5, NULL, NULL, 1); | BG(serialize_lock) = 0; |
BG(sm_allowed_env_vars) = NULL; | |
| memset(&BG(serialize), 0, sizeof(BG(serialize))); |
| memset(&BG(unserialize), 0, sizeof(BG(unserialize))); |
|
|
memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex))); |
memset(&BG(url_adapt_state_ex), 0, sizeof(BG(url_adapt_state_ex))); |
|
|
Line 3492 static void basic_globals_ctor(php_basic_globals *basi
|
Line 3469 static void basic_globals_ctor(php_basic_globals *basi
|
|
|
static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC) /* {{{ */ |
static void basic_globals_dtor(php_basic_globals *basic_globals_p TSRMLS_DC) /* {{{ */ |
{ |
{ |
zend_hash_destroy(&BG(sm_protected_env_vars)); |
|
if (BG(sm_allowed_env_vars)) { |
|
free(BG(sm_allowed_env_vars)); |
|
} |
|
if (BG(url_adapt_state_ex).tags) { |
if (BG(url_adapt_state_ex).tags) { |
zend_hash_destroy(BG(url_adapt_state_ex).tags); |
zend_hash_destroy(BG(url_adapt_state_ex).tags); |
free(BG(url_adapt_state_ex).tags); |
free(BG(url_adapt_state_ex).tags); |
Line 3576 PHP_MINIT_FUNCTION(basic) /* {{{ */
|
Line 3549 PHP_MINIT_FUNCTION(basic) /* {{{ */
|
REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); |
REGISTER_LONG_CONSTANT("PHP_URL_PATH", PHP_URL_PATH, CONST_CS | CONST_PERSISTENT); |
REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); |
REGISTER_LONG_CONSTANT("PHP_URL_QUERY", PHP_URL_QUERY, CONST_CS | CONST_PERSISTENT); |
REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); |
REGISTER_LONG_CONSTANT("PHP_URL_FRAGMENT", PHP_URL_FRAGMENT, CONST_CS | CONST_PERSISTENT); |
|
REGISTER_LONG_CONSTANT("PHP_QUERY_RFC1738", PHP_QUERY_RFC1738, CONST_CS | CONST_PERSISTENT); |
|
REGISTER_LONG_CONSTANT("PHP_QUERY_RFC3986", PHP_QUERY_RFC3986, CONST_CS | CONST_PERSISTENT); |
|
|
#define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) |
#define REGISTER_MATH_CONSTANT(x) REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | CONST_PERSISTENT) |
REGISTER_MATH_CONSTANT(M_E); |
REGISTER_MATH_CONSTANT(M_E); |
Line 3607 PHP_MINIT_FUNCTION(basic) /* {{{ */
|
Line 3582 PHP_MINIT_FUNCTION(basic) /* {{{ */
|
test_class_startup(); |
test_class_startup(); |
#endif |
#endif |
|
|
REGISTER_INI_ENTRIES(); |
|
|
|
register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU); |
register_phpinfo_constants(INIT_FUNC_ARGS_PASSTHRU); |
register_html_constants(INIT_FUNC_ARGS_PASSTHRU); |
register_html_constants(INIT_FUNC_ARGS_PASSTHRU); |
register_string_constants(INIT_FUNC_ARGS_PASSTHRU); |
register_string_constants(INIT_FUNC_ARGS_PASSTHRU); |
Line 3691 PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
|
Line 3664 PHP_MSHUTDOWN_FUNCTION(basic) /* {{{ */
|
php_unregister_url_stream_wrapper("ftp" TSRMLS_CC); |
php_unregister_url_stream_wrapper("ftp" TSRMLS_CC); |
#endif |
#endif |
|
|
UNREGISTER_INI_ENTRIES(); |
|
|
|
PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU); |
PHP_MSHUTDOWN(browscap)(SHUTDOWN_FUNC_ARGS_PASSTHRU); |
PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU); |
PHP_MSHUTDOWN(array)(SHUTDOWN_FUNC_ARGS_PASSTHRU); |
PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU); |
PHP_MSHUTDOWN(assert)(SHUTDOWN_FUNC_ARGS_PASSTHRU); |
Line 3739 PHP_RINIT_FUNCTION(basic) /* {{{ */
|
Line 3710 PHP_RINIT_FUNCTION(basic) /* {{{ */
|
PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU); |
PHP_RINIT(dir)(INIT_FUNC_ARGS_PASSTHRU); |
PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU); |
PHP_RINIT(url_scanner_ex)(INIT_FUNC_ARGS_PASSTHRU); |
|
|
/* Reset magic_quotes_runtime */ |
|
PG(magic_quotes_runtime) = INI_BOOL("magic_quotes_runtime"); |
|
|
|
/* Setup default context */ |
/* Setup default context */ |
FG(default_context) = NULL; |
FG(default_context) = NULL; |
|
|
Line 3751 PHP_RINIT_FUNCTION(basic) /* {{{ */
|
Line 3719 PHP_RINIT_FUNCTION(basic) /* {{{ */
|
/* Default to global filters only */ |
/* Default to global filters only */ |
FG(stream_filters) = NULL; |
FG(stream_filters) = NULL; |
|
|
|
FG(wrapper_errors) = NULL; |
|
|
return SUCCESS; |
return SUCCESS; |
} |
} |
/* }}} */ |
/* }}} */ |
Line 4083 PHP_FUNCTION(putenv)
|
Line 4053 PHP_FUNCTION(putenv)
|
} |
} |
#endif |
#endif |
|
|
if (PG(safe_mode)) { |
|
/* Check the protected list */ |
|
if (zend_hash_exists(&BG(sm_protected_env_vars), pe.key, pe.key_len)) { |
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Safe Mode warning: Cannot override protected environment variable '%s'", pe.key); |
|
efree(pe.putenv_string); |
|
efree(pe.key); |
|
RETURN_FALSE; |
|
} |
|
|
|
/* Check the allowed list */ |
|
if (BG(sm_allowed_env_vars) && *BG(sm_allowed_env_vars)) { |
|
char *allowed_env_vars = estrdup(BG(sm_allowed_env_vars)); |
|
char *strtok_buf = NULL; |
|
char *allowed_prefix = php_strtok_r(allowed_env_vars, ", ", &strtok_buf); |
|
zend_bool allowed = 0; |
|
|
|
while (allowed_prefix) { |
|
if (!strncmp(allowed_prefix, pe.key, strlen(allowed_prefix))) { |
|
allowed = 1; |
|
break; |
|
} |
|
allowed_prefix = php_strtok_r(NULL, ", ", &strtok_buf); |
|
} |
|
efree(allowed_env_vars); |
|
if (!allowed) { |
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Safe Mode warning: Cannot set environment variable '%s' - it's not in the allowed list", pe.key); |
|
efree(pe.putenv_string); |
|
efree(pe.key); |
|
RETURN_FALSE; |
|
} |
|
} |
|
} |
|
|
|
zend_hash_del(&BG(putenv_ht), pe.key, pe.key_len+1); |
zend_hash_del(&BG(putenv_ht), pe.key, pe.key_len+1); |
|
|
/* find previous value */ |
/* find previous value */ |
Line 4495 PHP_FUNCTION(time_nanosleep)
|
Line 4432 PHP_FUNCTION(time_nanosleep)
|
return; |
return; |
} |
} |
|
|
|
if (tv_sec < 0) { |
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The seconds value must be greater than 0"); |
|
RETURN_FALSE; |
|
} |
|
if (tv_nsec < 0) { |
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The nanoseconds value must be greater than 0"); |
|
RETURN_FALSE; |
|
} |
|
|
php_req.tv_sec = (time_t) tv_sec; |
php_req.tv_sec = (time_t) tv_sec; |
php_req.tv_nsec = tv_nsec; |
php_req.tv_nsec = tv_nsec; |
if (!nanosleep(&php_req, &php_rem)) { |
if (!nanosleep(&php_req, &php_rem)) { |
Line 4563 PHP_FUNCTION(get_current_user)
|
Line 4509 PHP_FUNCTION(get_current_user)
|
return; |
return; |
} |
} |
|
|
RETURN_STRING(php_get_current_user(), 1); | RETURN_STRING(php_get_current_user(TSRMLS_C), 1); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 4619 PHP_FUNCTION(get_cfg_var)
|
Line 4565 PHP_FUNCTION(get_cfg_var)
|
/* }}} */ |
/* }}} */ |
|
|
/* {{{ proto bool set_magic_quotes_runtime(int new_setting) |
/* {{{ proto bool set_magic_quotes_runtime(int new_setting) |
Set the current active configuration setting of magic_quotes_runtime and return previous */ | magic_quotes_runtime is not supported anymore */ |
PHP_FUNCTION(set_magic_quotes_runtime) |
PHP_FUNCTION(set_magic_quotes_runtime) |
{ |
{ |
zend_bool new_setting; |
zend_bool new_setting; |
Line 4627 PHP_FUNCTION(set_magic_quotes_runtime)
|
Line 4573 PHP_FUNCTION(set_magic_quotes_runtime)
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) { |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &new_setting) == FAILURE) { |
return; |
return; |
} |
} |
| |
PG(magic_quotes_runtime) = new_setting; | if (new_setting) { |
RETURN_TRUE; | php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "magic_quotes_runtime is not supported anymore"); |
| } |
| RETURN_FALSE; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 4637 PHP_FUNCTION(set_magic_quotes_runtime)
|
Line 4585 PHP_FUNCTION(set_magic_quotes_runtime)
|
Get the current active configuration setting of magic_quotes_runtime */ |
Get the current active configuration setting of magic_quotes_runtime */ |
PHP_FUNCTION(get_magic_quotes_runtime) |
PHP_FUNCTION(get_magic_quotes_runtime) |
{ |
{ |
RETURN_LONG(PG(magic_quotes_runtime)); | if (zend_parse_parameters_none() == FAILURE) { |
| return; |
| } |
| RETURN_FALSE; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 4645 PHP_FUNCTION(get_magic_quotes_runtime)
|
Line 4596 PHP_FUNCTION(get_magic_quotes_runtime)
|
Get the current active configuration setting of magic_quotes_gpc */ |
Get the current active configuration setting of magic_quotes_gpc */ |
PHP_FUNCTION(get_magic_quotes_gpc) |
PHP_FUNCTION(get_magic_quotes_gpc) |
{ |
{ |
RETURN_LONG(PG(magic_quotes_gpc)); | if (zend_parse_parameters_none() == FAILURE) { |
| return; |
| } |
| RETURN_FALSE; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 4672 PHP_FUNCTION(error_log)
|
Line 4626 PHP_FUNCTION(error_log)
|
int opt_err = 0, argc = ZEND_NUM_ARGS(); |
int opt_err = 0, argc = ZEND_NUM_ARGS(); |
long erropt = 0; |
long erropt = 0; |
|
|
if (zend_parse_parameters(argc TSRMLS_CC, "s|lss", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { | if (zend_parse_parameters(argc TSRMLS_CC, "s|lps", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) { |
return; |
return; |
} |
} |
|
|
Line 4680 PHP_FUNCTION(error_log)
|
Line 4634 PHP_FUNCTION(error_log)
|
opt_err = erropt; |
opt_err = erropt; |
} |
} |
|
|
if (opt_err == 3 && opt) { |
|
if (strlen(opt) != opt_len) { |
|
RETURN_FALSE; |
|
} |
|
} |
|
|
|
if (_php_error_log_ex(opt_err, message, message_len, opt, headers TSRMLS_CC) == FAILURE) { |
if (_php_error_log_ex(opt_err, message, message_len, opt, headers TSRMLS_CC) == FAILURE) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
Line 4719 PHPAPI int _php_error_log_ex(int opt_err, char *messag
|
Line 4667 PHPAPI int _php_error_log_ex(int opt_err, char *messag
|
break; |
break; |
|
|
case 3: /*save to a file */ |
case 3: /*save to a file */ |
stream = php_stream_open_wrapper(opt, "a", IGNORE_URL_WIN | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); | stream = php_stream_open_wrapper(opt, "a", IGNORE_URL_WIN | REPORT_ERRORS, NULL); |
if (!stream) { |
if (!stream) { |
return FAILURE; |
return FAILURE; |
} |
} |
Line 4729 PHPAPI int _php_error_log_ex(int opt_err, char *messag
|
Line 4677 PHPAPI int _php_error_log_ex(int opt_err, char *messag
|
|
|
case 4: /* send to SAPI */ |
case 4: /* send to SAPI */ |
if (sapi_module.log_message) { |
if (sapi_module.log_message) { |
sapi_module.log_message(message); | sapi_module.log_message(message TSRMLS_CC); |
} else { |
} else { |
return FAILURE; |
return FAILURE; |
} |
} |
Line 5145 PHP_FUNCTION(register_shutdown_function)
|
Line 5093 PHP_FUNCTION(register_shutdown_function)
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
PHPAPI zend_bool register_user_shutdown_function(char *function_name, size_t function_len, php_shutdown_function_entry *shutdown_function_entry TSRMLS_DC) /* {{{ */ |
|
{ |
|
if (!BG(user_shutdown_function_names)) { |
|
ALLOC_HASHTABLE(BG(user_shutdown_function_names)); |
|
zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0); |
|
} |
|
|
|
return zend_hash_update(BG(user_shutdown_function_names), function_name, function_len, shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL) != FAILURE; |
|
} |
|
/* }}} */ |
|
|
|
PHPAPI zend_bool remove_user_shutdown_function(char *function_name, size_t function_len TSRMLS_DC) /* {{{ */ |
|
{ |
|
if (BG(user_shutdown_function_names)) { |
|
return zend_hash_del_key_or_index(BG(user_shutdown_function_names), function_name, function_len, 0, HASH_DEL_KEY) != FAILURE; |
|
} |
|
|
|
return 0; |
|
} |
|
/* }}} */ |
|
|
|
PHPAPI zend_bool append_user_shutdown_function(php_shutdown_function_entry shutdown_function_entry TSRMLS_DC) /* {{{ */ |
|
{ |
|
if (!BG(user_shutdown_function_names)) { |
|
ALLOC_HASHTABLE(BG(user_shutdown_function_names)); |
|
zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0); |
|
} |
|
|
|
return zend_hash_next_index_insert(BG(user_shutdown_function_names), &shutdown_function_entry, sizeof(php_shutdown_function_entry), NULL) != FAILURE; |
|
} |
|
/* }}} */ |
|
|
ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini) /* {{{ */ |
ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini) /* {{{ */ |
{ |
{ |
syntax_highlighter_ini->highlight_comment = INI_STR("highlight.comment"); |
syntax_highlighter_ini->highlight_comment = INI_STR("highlight.comment"); |
Line 5160 ZEND_API void php_get_highlight_struct(zend_syntax_hig
|
Line 5140 ZEND_API void php_get_highlight_struct(zend_syntax_hig
|
PHP_FUNCTION(highlight_file) |
PHP_FUNCTION(highlight_file) |
{ |
{ |
char *filename; |
char *filename; |
int filename_len; | int filename_len, ret; |
zend_syntax_highlighter_ini syntax_highlighter_ini; |
zend_syntax_highlighter_ini syntax_highlighter_ini; |
zend_bool i = 0; |
zend_bool i = 0; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &filename, &filename_len, &i) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &filename, &filename_len, &i) == FAILURE) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_ALLOW_ONLY_FILE))) { |
|
RETURN_FALSE; |
|
} |
|
|
|
if (php_check_open_basedir(filename TSRMLS_CC)) { |
if (php_check_open_basedir(filename TSRMLS_CC)) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if (strlen(filename) != filename_len) { |
|
RETURN_FALSE; |
|
} |
|
|
|
if (i) { |
if (i) { |
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); | php_output_start_default(TSRMLS_C); |
} |
} |
|
|
php_get_highlight_struct(&syntax_highlighter_ini); |
php_get_highlight_struct(&syntax_highlighter_ini); |
|
|
if (highlight_file(filename, &syntax_highlighter_ini TSRMLS_CC) == FAILURE) { | ret = highlight_file(filename, &syntax_highlighter_ini TSRMLS_CC); |
if (i) { | |
int res = php_ob_get_buffer(return_value TSRMLS_CC); | |
|
|
/* flush the buffer only if there is something to flush */ | if (ret == FAILURE) { |
if (res == SUCCESS && Z_STRLEN_P(return_value) > 0) { | if (i) { |
php_end_ob_buffer (1, 0 TSRMLS_CC); | php_output_end(TSRMLS_C); |
zval_dtor(return_value); | |
} else { | |
php_end_ob_buffer (0, 0 TSRMLS_CC); | |
if (res == SUCCESS) { | |
zval_dtor(return_value); | |
} | |
} | |
} |
} |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if (i) { |
if (i) { |
php_ob_get_buffer (return_value TSRMLS_CC); | php_output_get_contents(return_value TSRMLS_CC); |
php_end_ob_buffer (0, 0 TSRMLS_CC); | php_output_discard(TSRMLS_C); |
} else { |
} else { |
RETURN_TRUE; |
RETURN_TRUE; |
} |
} |
Line 5222 PHP_FUNCTION(php_strip_whitespace)
|
Line 5185 PHP_FUNCTION(php_strip_whitespace)
|
zend_lex_state original_lex_state; |
zend_lex_state original_lex_state; |
zend_file_handle file_handle = {0}; |
zend_file_handle file_handle = {0}; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &filename, &filename_len) == FAILURE) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if (strlen(filename) != filename_len) { | php_output_start_default(TSRMLS_C); |
RETURN_FALSE; | |
} | |
|
|
file_handle.type = ZEND_HANDLE_FILENAME; |
file_handle.type = ZEND_HANDLE_FILENAME; |
file_handle.filename = filename; |
file_handle.filename = filename; |
file_handle.free_filename = 0; |
file_handle.free_filename = 0; |
file_handle.opened_path = NULL; |
file_handle.opened_path = NULL; |
zend_save_lexical_state(&original_lex_state TSRMLS_CC); |
zend_save_lexical_state(&original_lex_state TSRMLS_CC); |
if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) { | if (open_file_for_scanning(&file_handle TSRMLS_CC) == FAILURE) { |
zend_restore_lexical_state(&original_lex_state TSRMLS_CC); |
zend_restore_lexical_state(&original_lex_state TSRMLS_CC); |
|
php_output_end(TSRMLS_C); |
RETURN_EMPTY_STRING(); |
RETURN_EMPTY_STRING(); |
} |
} |
|
|
php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); |
|
|
|
zend_strip(TSRMLS_C); |
zend_strip(TSRMLS_C); |
|
|
zend_destroy_file_handle(&file_handle TSRMLS_CC); |
zend_destroy_file_handle(&file_handle TSRMLS_CC); |
zend_restore_lexical_state(&original_lex_state TSRMLS_CC); |
zend_restore_lexical_state(&original_lex_state TSRMLS_CC); |
|
|
php_ob_get_buffer(return_value TSRMLS_CC); | php_output_get_contents(return_value TSRMLS_CC); |
php_end_ob_buffer(0, 0 TSRMLS_CC); | php_output_discard(TSRMLS_C); |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
Line 5268 PHP_FUNCTION(highlight_string)
|
Line 5228 PHP_FUNCTION(highlight_string)
|
convert_to_string_ex(expr); |
convert_to_string_ex(expr); |
|
|
if (i) { |
if (i) { |
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); | php_output_start_default(TSRMLS_C); |
} |
} |
|
|
EG(error_reporting) = E_ERROR; |
EG(error_reporting) = E_ERROR; |
Line 5281 PHP_FUNCTION(highlight_string)
|
Line 5241 PHP_FUNCTION(highlight_string)
|
efree(hicompiled_string_description); |
efree(hicompiled_string_description); |
EG(error_reporting) = old_error_reporting; |
EG(error_reporting) = old_error_reporting; |
if (i) { |
if (i) { |
php_end_ob_buffer (1, 0 TSRMLS_CC); | php_output_end(TSRMLS_C); |
} |
} |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
Line 5290 PHP_FUNCTION(highlight_string)
|
Line 5250 PHP_FUNCTION(highlight_string)
|
EG(error_reporting) = old_error_reporting; |
EG(error_reporting) = old_error_reporting; |
|
|
if (i) { |
if (i) { |
php_ob_get_buffer (return_value TSRMLS_CC); | php_output_get_contents(return_value TSRMLS_CC); |
php_end_ob_buffer (0, 0 TSRMLS_CC); | php_output_discard(TSRMLS_C); |
} else { |
} else { |
RETURN_TRUE; |
RETURN_TRUE; |
} |
} |
Line 5426 PHP_FUNCTION(ini_set)
|
Line 5386 PHP_FUNCTION(ini_set)
|
} |
} |
|
|
#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini)) |
#define _CHECK_PATH(var, var_len, ini) php_ini_check_path(var, var_len, ini, sizeof(ini)) |
/* safe_mode & basedir check */ | /* open basedir check */ |
if (PG(safe_mode) || PG(open_basedir)) { | if (PG(open_basedir)) { |
if (_CHECK_PATH(varname, varname_len, "error_log") || |
if (_CHECK_PATH(varname, varname_len, "error_log") || |
_CHECK_PATH(varname, varname_len, "java.class.path") || |
_CHECK_PATH(varname, varname_len, "java.class.path") || |
_CHECK_PATH(varname, varname_len, "java.home") || |
_CHECK_PATH(varname, varname_len, "java.home") || |
_CHECK_PATH(varname, varname_len, "mail.log") || |
_CHECK_PATH(varname, varname_len, "mail.log") || |
_CHECK_PATH(varname, varname_len, "java.library.path") || |
_CHECK_PATH(varname, varname_len, "java.library.path") || |
_CHECK_PATH(varname, varname_len, "vpopmail.directory")) { |
_CHECK_PATH(varname, varname_len, "vpopmail.directory")) { |
if (PG(safe_mode) && (!php_checkuid(new_value, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { |
|
zval_dtor(return_value); |
|
RETURN_FALSE; |
|
} |
|
if (php_check_open_basedir(new_value TSRMLS_CC)) { |
if (php_check_open_basedir(new_value TSRMLS_CC)) { |
zval_dtor(return_value); |
zval_dtor(return_value); |
RETURN_FALSE; |
RETURN_FALSE; |
Line 5445 PHP_FUNCTION(ini_set)
|
Line 5401 PHP_FUNCTION(ini_set)
|
} |
} |
} |
} |
|
|
/* checks that ensure the user does not overwrite certain ini settings when safe_mode is enabled */ |
|
if (PG(safe_mode)) { |
|
if (!strncmp("max_execution_time", varname, sizeof("max_execution_time")) || |
|
!strncmp("memory_limit", varname, sizeof("memory_limit")) || |
|
!strncmp("child_terminate", varname, sizeof("child_terminate")) |
|
) { |
|
zval_dtor(return_value); |
|
RETURN_FALSE; |
|
} |
|
} |
|
|
|
if (zend_alter_ini_entry_ex(varname, varname_len + 1, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) { |
if (zend_alter_ini_entry_ex(varname, varname_len + 1, new_value, new_value_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0 TSRMLS_CC) == FAILURE) { |
zval_dtor(return_value); |
zval_dtor(return_value); |
RETURN_FALSE; |
RETURN_FALSE; |
Line 5490 PHP_FUNCTION(set_include_path)
|
Line 5435 PHP_FUNCTION(set_include_path)
|
return; |
return; |
} |
} |
|
|
/* No nulls allowed in paths */ |
|
if (strlen(new_value) != new_value_len) { |
|
RETURN_FALSE; |
|
} |
|
|
|
old_value = zend_ini_string("include_path", sizeof("include_path"), 0); |
old_value = zend_ini_string("include_path", sizeof("include_path"), 0); |
/* copy to return here, because alter might free it! */ |
/* copy to return here, because alter might free it! */ |
if (old_value) { |
if (old_value) { |
Line 5553 PHP_FUNCTION(print_r)
|
Line 5493 PHP_FUNCTION(print_r)
|
} |
} |
|
|
if (do_return) { |
if (do_return) { |
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC); | php_output_start_default(TSRMLS_C); |
} |
} |
|
|
zend_print_zval_r(var, 0 TSRMLS_CC); |
zend_print_zval_r(var, 0 TSRMLS_CC); |
|
|
if (do_return) { |
if (do_return) { |
php_ob_get_buffer (return_value TSRMLS_CC); | php_output_get_contents(return_value TSRMLS_CC); |
php_end_ob_buffer (0, 0 TSRMLS_CC); | php_output_discard(TSRMLS_C); |
} else { |
} else { |
RETURN_TRUE; |
RETURN_TRUE; |
} |
} |
Line 5805 PHP_FUNCTION(is_uploaded_file)
|
Line 5745 PHP_FUNCTION(is_uploaded_file)
|
return; |
return; |
} |
} |
|
|
if (strlen(path) != path_len) { |
|
RETURN_FALSE; |
|
} |
|
|
|
if (zend_hash_exists(SG(rfc1867_uploaded_files), path, path_len + 1)) { |
if (zend_hash_exists(SG(rfc1867_uploaded_files), path, path_len + 1)) { |
RETURN_TRUE; |
RETURN_TRUE; |
} else { |
} else { |
Line 5841 PHP_FUNCTION(move_uploaded_file)
|
Line 5777 PHP_FUNCTION(move_uploaded_file)
|
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if (PG(safe_mode) && (!php_checkuid(new_path, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { |
|
RETURN_FALSE; |
|
} |
|
|
|
if (php_check_open_basedir(new_path TSRMLS_CC)) { |
if (php_check_open_basedir(new_path TSRMLS_CC)) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if (strlen(path) != path_len) { |
|
RETURN_FALSE; |
|
} |
|
|
|
if (strlen(new_path) != new_path_len) { |
|
RETURN_FALSE; |
|
} |
|
|
|
if (VCWD_RENAME(path, new_path) == 0) { |
if (VCWD_RENAME(path, new_path) == 0) { |
successful = 1; |
successful = 1; |
#ifndef PHP_WIN32 |
#ifndef PHP_WIN32 |
Line 5990 PHP_FUNCTION(parse_ini_file)
|
Line 5914 PHP_FUNCTION(parse_ini_file)
|
zend_file_handle fh; |
zend_file_handle fh; |
zend_ini_parser_cb_t ini_parser_cb; |
zend_ini_parser_cb_t ini_parser_cb; |
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|bl", &filename, &filename_len, &process_sections, &scanner_mode) == FAILURE) { |
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
Line 5999 PHP_FUNCTION(parse_ini_file)
|
Line 5923 PHP_FUNCTION(parse_ini_file)
|
RETURN_FALSE; |
RETURN_FALSE; |
} |
} |
|
|
if (strlen(filename) != filename_len) { |
|
RETURN_FALSE; |
|
} |
|
|
|
/* Set callback function */ |
/* Set callback function */ |
if (process_sections) { |
if (process_sections) { |
BG(active_ini_file_section) = NULL; |
BG(active_ini_file_section) = NULL; |
Line 6079 PHP_FUNCTION(config_get_hash) /* {{{ */
|
Line 5999 PHP_FUNCTION(config_get_hash) /* {{{ */
|
/* }}} */ |
/* }}} */ |
#endif |
#endif |
|
|
static int copy_request_variable(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ |
|
{ |
|
zval *prefix, new_key; |
|
int prefix_len; |
|
zval **var = (zval **) pDest; |
|
|
|
if (num_args != 1) { |
|
return 0; |
|
} |
|
|
|
prefix = va_arg(args, zval *); |
|
prefix_len = Z_STRLEN_P(prefix); |
|
|
|
if (!prefix_len && !hash_key->nKeyLength) { |
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Numeric key detected - possible security hazard"); |
|
return 0; |
|
} |
|
|
|
if (hash_key->nKeyLength) { |
|
php_prefix_varname(&new_key, prefix, hash_key->arKey, hash_key->nKeyLength - 1, 0 TSRMLS_CC); |
|
} else { |
|
zval num; |
|
|
|
ZVAL_LONG(&num, hash_key->h); |
|
convert_to_string(&num); |
|
php_prefix_varname(&new_key, prefix, Z_STRVAL(num), Z_STRLEN(num), 0 TSRMLS_CC); |
|
zval_dtor(&num); |
|
} |
|
|
|
if (php_varname_check(Z_STRVAL(new_key), Z_STRLEN(new_key), 0 TSRMLS_CC) == FAILURE) { |
|
zval_dtor(&new_key); |
|
return 0; |
|
} |
|
|
|
zend_delete_global_variable(Z_STRVAL(new_key), Z_STRLEN(new_key) TSRMLS_CC); |
|
ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), Z_STRVAL(new_key), Z_STRLEN(new_key) + 1, *var, Z_REFCOUNT_PP(var) + 1, 0); |
|
|
|
zval_dtor(&new_key); |
|
return 0; |
|
} |
|
/* }}} */ |
|
|
|
/* {{{ proto bool import_request_variables(string types [, string prefix]) |
|
Import GET/POST/Cookie variables into the global scope */ |
|
PHP_FUNCTION(import_request_variables) |
|
{ |
|
char *types; |
|
int types_len; |
|
zval *prefix = NULL; |
|
char *p; |
|
zend_bool ok = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z/", &types, &types_len, &prefix) == FAILURE) { |
|
return; |
|
} |
|
|
|
if (ZEND_NUM_ARGS() > 1) { |
|
convert_to_string(prefix); |
|
|
|
if (Z_STRLEN_P(prefix) == 0) { |
|
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No prefix specified - possible security hazard"); |
|
} |
|
} else { |
|
MAKE_STD_ZVAL(prefix); |
|
ZVAL_EMPTY_STRING(prefix); |
|
} |
|
|
|
for (p = types; p && *p; p++) { |
|
switch (*p) { |
|
|
|
case 'g': |
|
case 'G': |
|
zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix); |
|
ok = 1; |
|
break; |
|
|
|
case 'p': |
|
case 'P': |
|
zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix); |
|
zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_FILES]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix); |
|
ok = 1; |
|
break; |
|
|
|
case 'c': |
|
case 'C': |
|
zend_hash_apply_with_arguments(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]) TSRMLS_CC, (apply_func_args_t) copy_request_variable, 1, prefix); |
|
ok = 1; |
|
break; |
|
} |
|
} |
|
|
|
if (ZEND_NUM_ARGS() < 2) { |
|
zval_ptr_dtor(&prefix); |
|
} |
|
RETURN_BOOL(ok); |
|
} |
|
/* }}} */ |
|
|
|
#ifdef HAVE_GETLOADAVG |
#ifdef HAVE_GETLOADAVG |
/* {{{ proto array sys_getloadavg() |
/* {{{ proto array sys_getloadavg() |
*/ |
*/ |
PHP_FUNCTION(sys_getloadavg) |
PHP_FUNCTION(sys_getloadavg) |
{ |
{ |
double load[3]; |
double load[3]; |
|
|
|
if (zend_parse_parameters_none() == FAILURE) { |
|
return; |
|
} |
|
|
if (getloadavg(load, 3) == -1) { |
if (getloadavg(load, 3) == -1) { |
RETURN_FALSE; |
RETURN_FALSE; |