summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-04-07 13:45:23 +0000
committerDmitry Stogov <dmitry@php.net>2006-04-07 13:45:23 +0000
commit79b3d79a95717eafbfbfde22c94052d906c5dcc0 (patch)
treec2e00f504434c349ffe7824bb9f89f9c780b78e6
parent670ed5d93f876cb820ac03670b90aa68d19c8fb3 (diff)
downloadphp-git-79b3d79a95717eafbfbfde22c94052d906c5dcc0.tar.gz
CGI anf FastCGI assume $_SERVER and $_ENV have the same values,
so we don't need construct the same arrays twich and may just copy it
-rw-r--r--sapi/cgi/cgi_main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 77df4f6263..a7460c8cc4 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -431,6 +431,17 @@ static char *sapi_cgi_read_cookies(TSRMLS_D)
#if PHP_FASTCGI
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];
+ 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];
+ zval_copy_ctor(array_ptr);
+ return;
+ }
if (!FCGX_IsCGI()) {
FCGX_Request *request = (FCGX_Request *) SG(server_context);
char **env, *p;