summaryrefslogtreecommitdiff
path: root/sapi/cgi
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-11-03 13:51:48 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-11-03 13:51:48 +0000
commit6123f110210808aa2557d93e5de32cfbc32ec419 (patch)
tree22b3658bbd2e8e44c37c41d0e1b9a71c9d2184be /sapi/cgi
parentbd2ab7bc1557153242f3efbfdeab1721b20ac614 (diff)
downloadphp-git-6123f110210808aa2557d93e5de32cfbc32ec419.tar.gz
MFH:
Added filter support for $_SERVER in cgi/apache2 sapis Make sure PHP_SELF is filtered in Apache 1 sapi
Diffstat (limited to 'sapi/cgi')
-rw-r--r--sapi/cgi/cgi_main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 45b6262fe9..54216568e1 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -490,7 +490,10 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
zend_hash_get_current_key_ex(&request->env, &var, &var_len, &idx, 0, &pos) == HASH_KEY_IS_STRING &&
zend_hash_get_current_data_ex(&request->env, (void **) &val, &pos) == SUCCESS;
zend_hash_move_forward_ex(&request->env, &pos)) {
- php_register_variable(var, *val, array_ptr TSRMLS_CC);
+ int new_val_len;
+ if (sapi_module.input_filter(PARSE_SERVER, var.s, val, strlen(*val), &new_val_len TSRMLS_CC)) {
+ php_register_variable_safe(var.s, *val, new_val_len, array_ptr TSRMLS_CC);
+ }
}
PG(magic_quotes_gpc) = magic_quotes_gpc;
}
@@ -499,12 +502,16 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
{
+ int new_val_len;
+ char *val = SG(request_info).request_uri ? SG(request_info).request_uri : "";
/* In CGI mode, we consider the environment to be a part of the server
* variables
*/
php_import_environment_variables(track_vars_array TSRMLS_CC);
/* Build the special-case PHP_SELF variable for the CGI version */
- php_register_variable("PHP_SELF", (SG(request_info).request_uri ? SG(request_info).request_uri : ""), track_vars_array TSRMLS_CC);
+ if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &val, strlen(val), &new_val_len TSRMLS_CC)) {
+ php_register_variable_safe("PHP_SELF", val, new_val_len, track_vars_array TSRMLS_CC);
+ }
}
static void sapi_cgi_log_message(char *message)