]> granicus.if.org Git - php/commitdiff
Fixed bug #37341 ($_SERVER in included file is shortened to two entries, if $_ENV...
authorDmitry Stogov <dmitry@php.net>
Wed, 24 May 2006 07:55:19 +0000 (07:55 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 24 May 2006 07:55:19 +0000 (07:55 +0000)
NEWS
sapi/cgi/cgi_main.c

diff --git a/NEWS b/NEWS
index ca88662636e843e3b82ea375f402956d4260ec1f..722f3beda2aacd8d5efb7602915799a5bf7dd897 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,8 @@ PHP                                                                        NEWS
 - Fixed bug #37376 (fastcgi.c compile fail with gcc 2.95.4). (Ilia)
 - Fixed bug #37368 (Incorrect timestamp returned for strtotime()). (Derick)
 - Fixed bug #37348 (make PEAR install ignore open_basedir). (Ilia)
+- Fixed bug #37341 ($_SERVER in included file is shortened to two entries,
+  if $_ENV gets used). (Dmitry)
 - Fixed bug #37313 (sigemptyset() used without including <signal.h>).
   (jdolecek)
 - Fixed bug #37306 (max_execution_time = max_input_time). (Dmitry)
index 9b0f12c8a9ab1998d234c60154ea5145333b2233..1c137472146ed8069bca640127f816f855677d2d 100644 (file)
@@ -434,14 +434,18 @@ static char *sapi_cgi_read_cookies(TSRMLS_D)
 void cgi_php_import_environment_variables(zval *array_ptr TSRMLS_DC)
 {
        if (PG(http_globals)[TRACK_VARS_ENV] &&
-           array_ptr != PG(http_globals)[TRACK_VARS_ENV]) {
+           array_ptr != PG(http_globals)[TRACK_VARS_ENV] &&
+           Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY &&
+           zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0) {
            zval_dtor(array_ptr);
            *array_ptr = *PG(http_globals)[TRACK_VARS_ENV];
            INIT_PZVAL(array_ptr);
            zval_copy_ctor(array_ptr);
            return;
        } else if (PG(http_globals)[TRACK_VARS_SERVER] &&
-               array_ptr != PG(http_globals)[TRACK_VARS_SERVER]) {
+               array_ptr != PG(http_globals)[TRACK_VARS_SERVER] &&
+           Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
+           zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0) {
            zval_dtor(array_ptr);
            *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER];
            INIT_PZVAL(array_ptr);