]> granicus.if.org Git - php/commitdiff
The environment should *never* be magic quoted.
authorShane Caraveo <shane@php.net>
Sun, 23 Mar 2003 19:30:31 +0000 (19:30 +0000)
committerShane Caraveo <shane@php.net>
Sun, 23 Mar 2003 19:30:31 +0000 (19:30 +0000)
ext/standard/proc_open.c
main/php_variables.c

index 58f1c29ade26b93ccce41a94ebf3ca1f6d5301ec..1ab6f44b0cb7935059780db9dfa8f42c3bb13540 100644 (file)
@@ -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;
index ada4495f583f3bca21730602a9b04a972b1e6b76..a47980371d26af94e756af50c21b7d6a83c887f0 100644 (file)
@@ -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;
 }