Blame SOURCES/php-5.5.21-CVE-2016-5385.patch

6f0ac3
From 98b9dfaec95e6f910f125ed172cdbd25abd006ec Mon Sep 17 00:00:00 2001
6f0ac3
From: Stanislav Malyshev <stas@php.net>
6f0ac3
Date: Sun, 10 Jul 2016 16:17:54 -0700
6f0ac3
Subject: [PATCH] Fix for HTTP_PROXY issue.
6f0ac3
6f0ac3
The following changes are made:
6f0ac3
- _SERVER/_ENV only has HTTP_PROXY if the local environment has it,
6f0ac3
  and only one from the environment.
6f0ac3
- getenv('HTTP_PROXY') only returns one from the local environment
6f0ac3
- getenv has optional second parameter, telling it to only consider
6f0ac3
  local environment
6f0ac3
---
6f0ac3
 UPGRADING                      |  3 +++
6f0ac3
 ext/standard/basic_functions.c | 17 +++++++------
6f0ac3
 main/SAPI.c                    | 48 +++++++++++++++++++-----------------
6f0ac3
 main/php_variables.c           | 56 ++++++++++++++++++++++++++++--------------
6f0ac3
 4 files changed, 76 insertions(+), 48 deletions(-)
6f0ac3
6f0ac3
diff --git a/UPGRADING b/UPGRADING
6f0ac3
index 7b51ae5..84a925a 100644
6f0ac3
--- a/UPGRADING
6f0ac3
+++ b/UPGRADING
6f0ac3
@@ -194,6 +194,9 @@ PHP 5.5 UPGRADE NOTES
6f0ac3
 - Since 5.5.4, fputcsv() has fifth parameter escape_char, allowing to
6f0ac3
   specify escape char.
6f0ac3
 
6f0ac3
+- Since 5.5.38, getenv() has optional second parameter, making it only
6f0ac3
+  consider local environment and not SAPI environment if true.
6f0ac3
+
6f0ac3
 4a. unserialize() change
6f0ac3
 ------------------------
6f0ac3
 
6f0ac3
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
6f0ac3
index 50b6bc7..8cbba14 100644
6f0ac3
--- a/ext/standard/basic_functions.c
6f0ac3
+++ b/ext/standard/basic_functions.c
6f0ac3
@@ -3544,7 +3544,7 @@ PHPAPI double php_get_inf(void) /* {{{ */
6f0ac3
 
6f0ac3
 #define BASIC_ADD_SUBMODULE(module) \
6f0ac3
 	zend_hash_add_empty_element(&basic_submodules, #module, strlen(#module));
6f0ac3
-	
6f0ac3
+
6f0ac3
 #define BASIC_RINIT_SUBMODULE(module) \
6f0ac3
 	if (zend_hash_exists(&basic_submodules, #module, strlen(#module))) { \
6f0ac3
 		PHP_RINIT(module)(INIT_FUNC_ARGS_PASSTHRU); \
6f0ac3
@@ -4013,21 +4013,24 @@ PHP_FUNCTION(long2ip)
6f0ac3
  * System Functions *
6f0ac3
  ********************/
6f0ac3
 
6f0ac3
-/* {{{ proto string getenv(string varname)
6f0ac3
+/* {{{ proto string getenv(string varname[, bool local_only])
6f0ac3
    Get the value of an environment variable */
6f0ac3
 PHP_FUNCTION(getenv)
6f0ac3
 {
6f0ac3
 	char *ptr, *str;
6f0ac3
 	int str_len;
6f0ac3
+	zend_bool local_only = 0;
6f0ac3
 
6f0ac3
-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
6f0ac3
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &str, &str_len, &local_only) == FAILURE) {
6f0ac3
 		RETURN_FALSE;
6f0ac3
 	}
6f0ac3
 
6f0ac3
-	/* SAPI method returns an emalloc()'d string */
6f0ac3
-	ptr = sapi_getenv(str, str_len TSRMLS_CC);
6f0ac3
-	if (ptr) {
6f0ac3
-		RETURN_STRING(ptr, 0);
6f0ac3
+	if (!local_only) {
6f0ac3
+		/* SAPI method returns an emalloc()'d string */
6f0ac3
+		ptr = sapi_getenv(str, str_len TSRMLS_CC);
6f0ac3
+		if (ptr) {
6f0ac3
+			RETURN_STRING(ptr, 0);
6f0ac3
+		}
6f0ac3
 	}
6f0ac3
 #ifdef PHP_WIN32
6f0ac3
 	{
6f0ac3
diff --git a/main/SAPI.c b/main/SAPI.c
6f0ac3
index 0dd0b55..8a56c6d 100644
6f0ac3
--- a/main/SAPI.c
6f0ac3
+++ b/main/SAPI.c
6f0ac3
@@ -1,4 +1,4 @@
6f0ac3
-/* 
6f0ac3
+/*
6f0ac3
    +----------------------------------------------------------------------+
6f0ac3
    | PHP Version 5                                                        |
6f0ac3
    +----------------------------------------------------------------------+
6f0ac3
@@ -132,7 +132,7 @@ PHP_FUNCTION(header_register_callback)
6f0ac3
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &callback_func) == FAILURE) {
6f0ac3
 		return;
6f0ac3
 	}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	if (!zend_is_callable(callback_func, 0, &callback_name TSRMLS_CC)) {
6f0ac3
 		efree(callback_name);
6f0ac3
 		RETURN_FALSE;
6f0ac3
@@ -160,10 +160,10 @@ static void sapi_run_header_callback(TSRMLS_D)
6f0ac3
 	char *callback_name = NULL;
6f0ac3
 	char *callback_error = NULL;
6f0ac3
 	zval *retval_ptr = NULL;
6f0ac3
-	
6f0ac3
+
6f0ac3
 	if (zend_fcall_info_init(SG(callback_func), 0, &fci, &SG(fci_cache), &callback_name, &callback_error TSRMLS_CC) == SUCCESS) {
6f0ac3
 		fci.retval_ptr_ptr = &retval_ptr;
6f0ac3
-		
6f0ac3
+
6f0ac3
 		error = zend_call_function(&fci, &SG(fci_cache) TSRMLS_CC);
6f0ac3
 		if (error == FAILURE) {
6f0ac3
 			goto callback_failed;
6f0ac3
@@ -174,13 +174,13 @@ static void sapi_run_header_callback(TSRMLS_D)
6f0ac3
 callback_failed:
6f0ac3
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not call the sapi_header_callback");
6f0ac3
 	}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	if (callback_name) {
6f0ac3
 		efree(callback_name);
6f0ac3
 	}
6f0ac3
 	if (callback_error) {
6f0ac3
 		efree(callback_error);
6f0ac3
-	}	
6f0ac3
+	}
6f0ac3
 }
6f0ac3
 
6f0ac3
 SAPI_API void sapi_handle_post(void *arg TSRMLS_DC)
6f0ac3
@@ -386,11 +386,11 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D)
6f0ac3
 	if (SG(request_info).headers_read == 1)
6f0ac3
 		return;
6f0ac3
 	SG(request_info).headers_read = 1;
6f0ac3
-	zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), 
6f0ac3
+	zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct),
6f0ac3
 			(void (*)(void *)) sapi_free_header, 0);
6f0ac3
 	SG(sapi_headers).send_default_content_type = 1;
6f0ac3
 
6f0ac3
-	/* SG(sapi_headers).http_response_code = 200; */ 
6f0ac3
+	/* SG(sapi_headers).http_response_code = 200; */
6f0ac3
 	SG(sapi_headers).http_status_line = NULL;
6f0ac3
 	SG(sapi_headers).mimetype = NULL;
6f0ac3
 	SG(read_post_bytes) = 0;
6f0ac3
@@ -403,7 +403,7 @@ SAPI_API void sapi_activate_headers_only(TSRMLS_D)
6f0ac3
 	SG(global_request_time) = 0;
6f0ac3
 
6f0ac3
 	/*
6f0ac3
-	 * It's possible to override this general case in the activate() callback, 
6f0ac3
+	 * It's possible to override this general case in the activate() callback,
6f0ac3
 	 * if necessary.
6f0ac3
 	 */
6f0ac3
 	if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
6f0ac3
@@ -465,8 +465,8 @@ SAPI_API void sapi_activate(TSRMLS_D)
6f0ac3
 				 * depending on given content type */
6f0ac3
 				sapi_read_post_data(TSRMLS_C);
6f0ac3
 			} else {
6f0ac3
-				/* Any other method with content payload will fill $HTTP_RAW_POST_DATA 
6f0ac3
-				 * if it is enabled by always_populate_raw_post_data. 
6f0ac3
+				/* Any other method with content payload will fill $HTTP_RAW_POST_DATA
6f0ac3
+				 * if it is enabled by always_populate_raw_post_data.
6f0ac3
 				 * It's up to the webserver to decide whether to allow a method or not. */
6f0ac3
 				SG(request_info).content_type_dup = NULL;
6f0ac3
 				if (sapi_module.default_post_reader) {
6f0ac3
@@ -497,14 +497,14 @@ static void sapi_send_headers_free(TSRMLS_D)
6f0ac3
 		SG(sapi_headers).http_status_line = NULL;
6f0ac3
 	}
6f0ac3
 }
6f0ac3
-	
6f0ac3
+
6f0ac3
 SAPI_API void sapi_deactivate(TSRMLS_D)
6f0ac3
 {
6f0ac3
 	zend_llist_destroy(&SG(sapi_headers).headers);
6f0ac3
 	if (SG(request_info).post_data) {
6f0ac3
 		efree(SG(request_info).post_data);
6f0ac3
 	}  else 	if (SG(server_context)) {
6f0ac3
-		if(sapi_module.read_post) { 
6f0ac3
+		if(sapi_module.read_post) {
6f0ac3
 			/* make sure we've consumed all request input data */
6f0ac3
 			char dummy[SAPI_POST_BLOCK_SIZE];
6f0ac3
 			int read_bytes;
6f0ac3
@@ -516,7 +516,7 @@ SAPI_API void sapi_deactivate(TSRMLS_D)
6f0ac3
 	}
6f0ac3
 	if (SG(request_info).raw_post_data) {
6f0ac3
 		efree(SG(request_info).raw_post_data);
6f0ac3
-	} 
6f0ac3
+	}
6f0ac3
 	if (SG(request_info).auth_user) {
6f0ac3
 		efree(SG(request_info).auth_user);
6f0ac3
 	}
6f0ac3
@@ -574,7 +574,7 @@ static int sapi_extract_response_code(const char *header_line)
6f0ac3
 			break;
6f0ac3
 		}
6f0ac3
 	}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	return code;
6f0ac3
 }
6f0ac3
 
6f0ac3
@@ -594,7 +594,7 @@ static void sapi_update_response_code(int ncode TSRMLS_DC)
6f0ac3
 	SG(sapi_headers).http_response_code = ncode;
6f0ac3
 }
6f0ac3
 
6f0ac3
-/* 
6f0ac3
+/*
6f0ac3
  * since zend_llist_del_element only remove one matched item once,
6f0ac3
  * we should remove them by ourself
6f0ac3
  */
6f0ac3
@@ -630,7 +630,7 @@ SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bo
6f0ac3
 {
6f0ac3
 	sapi_header_line ctr = {0};
6f0ac3
 	int r;
6f0ac3
-	
6f0ac3
+
6f0ac3
 	ctr.line = header_line;
6f0ac3
 	ctr.line_len = header_line_len;
6f0ac3
 
6f0ac3
@@ -724,7 +724,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
6f0ac3
 		} while(header_line_len && isspace(header_line[header_line_len-1]));
6f0ac3
 		header_line[header_line_len]='\0';
6f0ac3
 	}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	if (op == SAPI_HEADER_DELETE) {
6f0ac3
 		if (strchr(header_line, ':')) {
6f0ac3
 			efree(header_line);
6f0ac3
@@ -762,7 +762,7 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
6f0ac3
 	sapi_header.header_len = header_line_len;
6f0ac3
 
6f0ac3
 	/* Check the header for a few cases that we have special support for in SAPI */
6f0ac3
-	if (header_line_len>=5 
6f0ac3
+	if (header_line_len>=5
6f0ac3
 		&& !strncasecmp(header_line, "HTTP/", 5)) {
6f0ac3
 		/* filter out the response code */
6f0ac3
 		sapi_update_response_code(sapi_extract_response_code(header_line) TSRMLS_CC);
6f0ac3
@@ -821,8 +821,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
6f0ac3
 					/* Return a Found Redirect if one is not already specified */
6f0ac3
 					if (http_response_code) { /* user specified redirect code */
6f0ac3
 						sapi_update_response_code(http_response_code TSRMLS_CC);
6f0ac3
-					} else if (SG(request_info).proto_num > 1000 && 
6f0ac3
-					   SG(request_info).request_method && 
6f0ac3
+					} else if (SG(request_info).proto_num > 1000 &&
6f0ac3
+					   SG(request_info).request_method &&
6f0ac3
 					   strcmp(SG(request_info).request_method, "HEAD") &&
6f0ac3
 					   strcmp(SG(request_info).request_method, "GET")) {
6f0ac3
 						sapi_update_response_code(303 TSRMLS_CC);
6f0ac3
@@ -1011,7 +1011,11 @@ SAPI_API struct stat *sapi_get_stat(TSRMLS_D)
6f0ac3
 
6f0ac3
 SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
6f0ac3
 {
6f0ac3
-	if (sapi_module.getenv) { 
6f0ac3
+	if (!strncasecmp(name, "HTTP_PROXY", name_len)) {
6f0ac3
+		/* Ugly fix for HTTP_PROXY issue */
6f0ac3
+		return NULL;
6f0ac3
+	}
6f0ac3
+	if (sapi_module.getenv) {
6f0ac3
 		char *value, *tmp = sapi_module.getenv(name, name_len TSRMLS_CC);
6f0ac3
 		if (tmp) {
6f0ac3
 			value = estrdup(tmp);
6f0ac3
diff --git a/main/php_variables.c b/main/php_variables.c
6f0ac3
index bf6b9f3..bbe57d3 100644
6f0ac3
--- a/main/php_variables.c
6f0ac3
+++ b/main/php_variables.c
6f0ac3
@@ -43,7 +43,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
6f0ac3
 {
6f0ac3
 	zval new_entry;
6f0ac3
 	assert(strval != NULL);
6f0ac3
-	
6f0ac3
+
6f0ac3
 	/* Prepare value */
6f0ac3
 	Z_STRLEN(new_entry) = str_len;
6f0ac3
 	Z_STRVAL(new_entry) = estrndup(strval, Z_STRLEN(new_entry));
6f0ac3
@@ -81,7 +81,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
6f0ac3
 	while (*var_name && *var_name==' ') {
6f0ac3
 		var_name++;
6f0ac3
 	}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	/*
6f0ac3
 	 * Prepare variable name
6f0ac3
 	 */
6f0ac3
@@ -167,7 +167,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
6f0ac3
 					return;
6f0ac3
 				}
6f0ac3
 				*ip = 0;
6f0ac3
-				new_idx_len = strlen(index_s);	
6f0ac3
+				new_idx_len = strlen(index_s);
6f0ac3
 			}
6f0ac3
 
6f0ac3
 			if (!index) {
6f0ac3
@@ -210,7 +210,7 @@ plain_var:
6f0ac3
 				zval_ptr_dtor(&gpc_element);
6f0ac3
 			}
6f0ac3
 		} else {
6f0ac3
-			/* 
6f0ac3
+			/*
6f0ac3
 			 * According to rfc2965, more specific paths are listed above the less specific ones.
6f0ac3
 			 * If we encounter a duplicate cookie name, we should skip it, since it is not possible
6f0ac3
 			 * to have the same (plain text) cookie name for the same path and we should not overwrite
6f0ac3
@@ -236,7 +236,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
6f0ac3
 
6f0ac3
 	if (SG(request_info).post_data == NULL) {
6f0ac3
 		return;
6f0ac3
-	}	
6f0ac3
+	}
6f0ac3
 
6f0ac3
 	s = SG(request_info).post_data;
6f0ac3
 	e = s + SG(request_info).post_data_length;
6f0ac3
@@ -284,7 +284,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
6f0ac3
 	int free_buffer = 0;
6f0ac3
 	char *strtok_buf = NULL;
6f0ac3
 	long count = 0;
6f0ac3
-	
6f0ac3
+
6f0ac3
 	switch (arg) {
6f0ac3
 		case PARSE_POST:
6f0ac3
 		case PARSE_GET:
6f0ac3
@@ -357,9 +357,9 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
6f0ac3
 			separator = ";\0";
6f0ac3
 			break;
6f0ac3
 	}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	var = php_strtok_r(res, separator, &strtok_buf);
6f0ac3
-	
6f0ac3
+
6f0ac3
 	while (var) {
6f0ac3
 		val = strchr(var, '=');
6f0ac3
 
6f0ac3
@@ -454,11 +454,11 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
6f0ac3
 	zval *arr, *argc, *tmp;
6f0ac3
 	int count = 0;
6f0ac3
 	char *ss, *space;
6f0ac3
-	
6f0ac3
+
6f0ac3
 	if (!(SG(request_info).argc || track_vars_array)) {
6f0ac3
 		return;
6f0ac3
 	}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	ALLOC_INIT_ZVAL(arr);
6f0ac3
 	array_init(arr);
6f0ac3
 
6f0ac3
@@ -519,7 +519,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
6f0ac3
 		Z_ADDREF_P(argc);
6f0ac3
 		zend_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
6f0ac3
 		zend_hash_update(&EG(symbol_table), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
6f0ac3
-	} 
6f0ac3
+	}
6f0ac3
 	if (track_vars_array) {
6f0ac3
 		Z_ADDREF_P(arr);
6f0ac3
 		Z_ADDREF_P(argc);
6f0ac3
@@ -649,7 +649,7 @@ static zend_bool php_auto_globals_create_get(const char *name, uint name_len TSR
6f0ac3
 
6f0ac3
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
6f0ac3
 	Z_ADDREF_P(vars);
6f0ac3
-	
6f0ac3
+
6f0ac3
 	return 0; /* don't rearm */
6f0ac3
 }
6f0ac3
 
6f0ac3
@@ -676,7 +676,7 @@ static zend_bool php_auto_globals_create_post(const char *name, uint name_len TS
6f0ac3
 
6f0ac3
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
6f0ac3
 	Z_ADDREF_P(vars);
6f0ac3
-	
6f0ac3
+
6f0ac3
 	return 0; /* don't rearm */
6f0ac3
 }
6f0ac3
 
6f0ac3
@@ -699,7 +699,7 @@ static zend_bool php_auto_globals_create_cookie(const char *name, uint name_len
6f0ac3
 
6f0ac3
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
6f0ac3
 	Z_ADDREF_P(vars);
6f0ac3
-	
6f0ac3
+
6f0ac3
 	return 0; /* don't rearm */
6f0ac3
 }
6f0ac3
 
6f0ac3
@@ -718,10 +718,26 @@ static zend_bool php_auto_globals_create_files(const char *name, uint name_len T
6f0ac3
 
6f0ac3
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &vars, sizeof(zval *), NULL);
6f0ac3
 	Z_ADDREF_P(vars);
6f0ac3
-	
6f0ac3
+
6f0ac3
 	return 0; /* don't rearm */
6f0ac3
 }
6f0ac3
 
6f0ac3
+/* Upgly hack to fix HTTP_PROXY issue */
6f0ac3
+static void check_http_proxy(HashTable *var_table) {
6f0ac3
+	if (zend_hash_exists(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY"))) {
6f0ac3
+		char *local_proxy = getenv("HTTP_PROXY");
6f0ac3
+
6f0ac3
+		if (!local_proxy) {
6f0ac3
+			zend_hash_del(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY"));
6f0ac3
+		} else {
6f0ac3
+			zval *local_zval;
6f0ac3
+			ALLOC_INIT_ZVAL(local_zval);
6f0ac3
+			ZVAL_STRING(local_zval, local_proxy, 1);
6f0ac3
+			zend_hash_update(var_table, "HTTP_PROXY", sizeof("HTTP_PROXY"), &local_zval, sizeof(zval **), NULL);
6f0ac3
+		}
6f0ac3
+	}
6f0ac3
+}
6f0ac3
+
6f0ac3
 static zend_bool php_auto_globals_create_server(const char *name, uint name_len TSRMLS_DC)
6f0ac3
 {
6f0ac3
 	if (PG(variables_order) && (strchr(PG(variables_order),'S') || strchr(PG(variables_order),'s'))) {
6f0ac3
@@ -730,7 +746,7 @@ static zend_bool php_auto_globals_create_server(const char *name, uint name_len
6f0ac3
 		if (PG(register_argc_argv)) {
6f0ac3
 			if (SG(request_info).argc) {
6f0ac3
 				zval **argc, **argv;
6f0ac3
-	
6f0ac3
+
6f0ac3
 				if (zend_hash_find(&EG(symbol_table), "argc", sizeof("argc"), (void**)&argc) == SUCCESS &&
6f0ac3
 					zend_hash_find(&EG(symbol_table), "argv", sizeof("argv"), (void**)&argv) == SUCCESS) {
6f0ac3
 					Z_ADDREF_PP(argc);
6f0ac3
@@ -742,7 +758,7 @@ static zend_bool php_auto_globals_create_server(const char *name, uint name_len
6f0ac3
 				php_build_argv(SG(request_info).query_string, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
6f0ac3
 			}
6f0ac3
 		}
6f0ac3
-	
6f0ac3
+
6f0ac3
 	} else {
6f0ac3
 		zval *server_vars=NULL;
6f0ac3
 		ALLOC_ZVAL(server_vars);
6f0ac3
@@ -754,9 +770,10 @@ static zend_bool php_auto_globals_create_server(const char *name, uint name_len
6f0ac3
 		PG(http_globals)[TRACK_VARS_SERVER] = server_vars;
6f0ac3
 	}
6f0ac3
 
6f0ac3
+	check_http_proxy(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]));
6f0ac3
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_SERVER], sizeof(zval *), NULL);
6f0ac3
 	Z_ADDREF_P(PG(http_globals)[TRACK_VARS_SERVER]);
6f0ac3
-	
6f0ac3
+
6f0ac3
 	return 0; /* don't rearm */
6f0ac3
 }
6f0ac3
 
6f0ac3
@@ -770,11 +787,12 @@ static zend_bool php_auto_globals_create_env(const char *name, uint name_len TSR
6f0ac3
 		zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
6f0ac3
 	}
6f0ac3
 	PG(http_globals)[TRACK_VARS_ENV] = env_vars;
6f0ac3
-	
6f0ac3
+
6f0ac3
 	if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) {
6f0ac3
 		php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
6f0ac3
 	}
6f0ac3
 
6f0ac3
+	check_http_proxy(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV]));
6f0ac3
 	zend_hash_update(&EG(symbol_table), name, name_len + 1, &PG(http_globals)[TRACK_VARS_ENV], sizeof(zval *), NULL);
6f0ac3
 	Z_ADDREF_P(PG(http_globals)[TRACK_VARS_ENV]);
6f0ac3
 
6f0ac3
-- 
6f0ac3
2.1.4
6f0ac3