@@ -624,20 +624,15 @@ static void cgi_php_load_env_var(char *var, unsigned int var_len, char *val, uns
624
624
625
625
static void cgi_php_import_environment_variables (zval * array_ptr )
626
626
{
627
+ if (Z_TYPE (PG (http_globals )[TRACK_VARS_ENV ]) != IS_ARRAY ) {
628
+ zend_is_auto_global_str ("_ENV" , sizeof ("_ENV" )- 1 );
629
+ }
630
+
627
631
if (Z_TYPE (PG (http_globals )[TRACK_VARS_ENV ]) == IS_ARRAY &&
628
- Z_ARR_P (array_ptr ) != Z_ARR (PG (http_globals )[TRACK_VARS_ENV ]) &&
629
- zend_hash_num_elements (Z_ARRVAL (PG (http_globals )[TRACK_VARS_ENV ])) > 0
630
- ) {
632
+ Z_ARR_P (array_ptr ) != Z_ARR (PG (http_globals )[TRACK_VARS_ENV ])) {
631
633
zval_dtor (array_ptr );
632
634
ZVAL_DUP (array_ptr , & PG (http_globals )[TRACK_VARS_ENV ]);
633
635
return ;
634
- } else if (Z_TYPE (PG (http_globals )[TRACK_VARS_SERVER ]) == IS_ARRAY &&
635
- Z_ARR_P (array_ptr ) != Z_ARR (PG (http_globals )[TRACK_VARS_SERVER ]) &&
636
- zend_hash_num_elements (Z_ARRVAL (PG (http_globals )[TRACK_VARS_SERVER ])) > 0
637
- ) {
638
- zval_dtor (array_ptr );
639
- ZVAL_DUP (array_ptr , & PG (http_globals )[TRACK_VARS_SERVER ]);
640
- return ;
641
636
}
642
637
643
638
/* call php's original import as a catch-all */
@@ -1983,6 +1978,11 @@ consult the installation file that came with this distribution, or visit \n\
1983
1978
}
1984
1979
fastcgi = fcgi_is_fastcgi ();
1985
1980
}
1981
+
1982
+ /* make php call us to get _ENV vars */
1983
+ php_php_import_environment_variables = php_import_environment_variables ;
1984
+ php_import_environment_variables = cgi_php_import_environment_variables ;
1985
+
1986
1986
if (fastcgi ) {
1987
1987
/* How many times to run PHP scripts before dying */
1988
1988
if (getenv ("PHP_FCGI_MAX_REQUESTS" )) {
@@ -1993,10 +1993,6 @@ consult the installation file that came with this distribution, or visit \n\
1993
1993
}
1994
1994
}
1995
1995
1996
- /* make php call us to get _ENV vars */
1997
- php_php_import_environment_variables = php_import_environment_variables ;
1998
- php_import_environment_variables = cgi_php_import_environment_variables ;
1999
-
2000
1996
/* library is already initialized, now init our request */
2001
1997
request = fcgi_init_request (fcgi_fd , NULL , NULL , NULL );
2002
1998
0 commit comments