diff options
| author | Dmitry Stogov <dmitry@php.net> | 2006-11-15 11:13:02 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2006-11-15 11:13:02 +0000 |
| commit | 0916ac47c952a1dbada36b196c3d9f9d83fc10dd (patch) | |
| tree | bae1875aaa1469efc5d276c3634c83dceb3914be /sapi/cgi/cgi_main.c | |
| parent | 60188ad863a4987d351d9873f1bd241a5ce2fb79 (diff) | |
| download | php-git-0916ac47c952a1dbada36b196c3d9f9d83fc10dd.tar.gz | |
Fixed wrong ext/filter behavior. It didn't register FastCGI environment variables and made memory leaks.
Diffstat (limited to 'sapi/cgi/cgi_main.c')
| -rw-r--r-- | sapi/cgi/cgi_main.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 2341be38e2..349df5b80e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -498,6 +498,7 @@ void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC) char *var, **val; uint var_len; ulong idx; + int filter_arg = (array_ptr == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; /* turn off magic_quotes while importing environment variables */ PG(magic_quotes_gpc) = 0; @@ -505,8 +506,8 @@ 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)) { - int new_val_len; - if (sapi_module.input_filter(PARSE_SERVER, var, val, strlen(*val), &new_val_len TSRMLS_CC)) { + unsigned int new_val_len; + if (sapi_module.input_filter(filter_arg, var, val, strlen(*val), &new_val_len TSRMLS_CC)) { php_register_variable_safe(var, *val, new_val_len, array_ptr TSRMLS_CC); } } @@ -517,7 +518,7 @@ 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; + unsigned 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 |
