summaryrefslogtreecommitdiff
path: root/sapi/cgi/cgi_main.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-05-24 07:55:19 +0000
committerDmitry Stogov <dmitry@php.net>2006-05-24 07:55:19 +0000
commit07b8d051fa9565bf07a1c408e3f467c1243b9ec7 (patch)
tree38e86932be7c6e8e8334188054fb5bcfd42ad5bb /sapi/cgi/cgi_main.c
parent1448086b22d9456d4e597ea757150a90d849d240 (diff)
downloadphp-git-07b8d051fa9565bf07a1c408e3f467c1243b9ec7.tar.gz
Fixed bug #37341 ($_SERVER in included file is shortened to two entries, if $_ENV gets used).
Diffstat (limited to 'sapi/cgi/cgi_main.c')
-rw-r--r--sapi/cgi/cgi_main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 9b0f12c8a9..1c13747214 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -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);