From: Dmitry Stogov Date: Wed, 24 May 2006 07:52:58 +0000 (+0000) Subject: Fixed bug #37341 ($_SERVER in included file is shortened to two entries, if $_ENV... X-Git-Tag: BEFORE_NEW_OUTPUT_API~105 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0f9c8e550e5d0c33a7fcfad3dd9c273ca9a48ae1;p=php Fixed bug #37341 ($_SERVER in included file is shortened to two entries, if $_ENV gets used). --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index e0741ee97b..71deaf07eb 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -413,14 +413,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);