diff options
Diffstat (limited to 'sapi/cgi/cgi_main.c')
-rw-r--r-- | sapi/cgi/cgi_main.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 2682cb674d..2e9cefedea 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -674,15 +674,17 @@ static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, uns static void cgi_php_import_environment_variables(zval *array_ptr) { - if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) != IS_ARRAY) { - zend_is_auto_global_str("_ENV", sizeof("_ENV")-1); - } + if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) { + if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) != IS_ARRAY) { + zend_is_auto_global_str("_ENV", sizeof("_ENV")-1); + } - if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && - Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) { - zend_array_destroy(Z_ARR_P(array_ptr)); - Z_ARR_P(array_ptr) = zend_array_dup(Z_ARR(PG(http_globals)[TRACK_VARS_ENV])); - return; + if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) { + zend_array_destroy(Z_ARR_P(array_ptr)); + Z_ARR_P(array_ptr) = zend_array_dup(Z_ARR(PG(http_globals)[TRACK_VARS_ENV])); + return; + } } /* call php's original import as a catch-all */ |