dmitry          Wed May 24 07:52:59 2006 UTC

  Modified files:              
    /php-src/sapi/cgi   cgi_main.c 
  Log:
  Fixed bug #37341 ($_SERVER in included file is shortened to two entries, if 
$_ENV gets used).
  
  
http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.287&r2=1.288&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.287 php-src/sapi/cgi/cgi_main.c:1.288
--- php-src/sapi/cgi/cgi_main.c:1.287   Mon May 15 14:30:50 2006
+++ php-src/sapi/cgi/cgi_main.c Wed May 24 07:52:58 2006
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.287 2006/05/15 14:30:50 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.288 2006/05/24 07:52:58 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -413,14 +413,18 @@
 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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to