From: Shane Caraveo Date: Sun, 23 Mar 2003 19:30:31 +0000 (+0000) Subject: The environment should *never* be magic quoted. X-Git-Tag: RELEASE_0_5~371 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=456b6cbeab2f3d770ba959712313b2c4f1a16c97;p=php The environment should *never* be magic quoted. --- diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 58f1c29ade..1ab6f44b0c 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -138,9 +138,6 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent strcat(p, "="); strcat(p, data); - if (PG(magic_quotes_gpc)) { - php_stripslashes(p, &l TSRMLS_CC); - } #ifndef PHP_WIN32 *ep = p; ++ep; @@ -149,9 +146,6 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent break; case HASH_KEY_IS_LONG: memcpy(p,data,el_len); - if (PG(magic_quotes_gpc)) { - php_stripslashes(p, &el_len TSRMLS_CC); - } #ifndef PHP_WIN32 *ep = p; ++ep; diff --git a/main/php_variables.c b/main/php_variables.c index ada4495f58..a47980371d 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -345,6 +345,9 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) { char **env, *p, *t; + /* turn off magic_quotes while importing environment variables */ + int magic_quotes_gpc = PG(magic_quotes_gpc); + PG(magic_quotes_gpc) = 0; for (env = environ; env != NULL && *env != NULL; env++) { p = strchr(*env, '='); @@ -355,6 +358,7 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC) php_register_variable(t, p+1, array_ptr TSRMLS_CC); efree(t); } + PG(magic_quotes_gpc) = magic_quotes_gpc; }