]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #21074 (Apache2: "ErrorDocument xxx /error.php" broken).
authorfoobar <sniper@php.net>
Fri, 11 Jul 2003 04:24:11 +0000 (04:24 +0000)
committerfoobar <sniper@php.net>
Fri, 11 Jul 2003 04:24:11 +0000 (04:24 +0000)
sapi/apache2filter/sapi_apache2.c
sapi/apache2handler/sapi_apache2.c

index f201983d543e0c71ac30c4b2b780c2c8e69f03ef..677e89e1f1189c004d621fecfd196d335d4e7e05 100644 (file)
@@ -435,10 +435,16 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
                return ap_pass_brigade(f->next, bb);
        }
 
-       /* setup standard CGI variables */
-       ap_add_common_vars(f->r);
-       ap_add_cgi_vars(f->r);
-
+       /* Setup the CGI variables if this is the main request.. */
+       if (f->r->main == NULL || 
+               /* .. or if the sub-request envinronment differs from the main-request. */
+               f->r->subprocess_env != f->r->main->subprocess_env
+       ) {
+               /* setup standard CGI variables */
+               ap_add_common_vars(f->r);
+               ap_add_cgi_vars(f->r);
+       }
+       
        ctx = SG(server_context);
        if (ctx == NULL) {
                ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, f->r,
index 81ea318130fd628942d887f840cf67ec97ab5c85..5e64c5161c690f456e4ec9786033d5e9e7877c5e 100644 (file)
@@ -470,9 +470,15 @@ static int php_handler(request_rec *r)
                return DECLINED;
        }
 
-       /* setup standard CGI variables */
-       ap_add_common_vars(r);
-       ap_add_cgi_vars(r);
+       /* Setup the CGI variables if this is the main request */
+       if (r->main == NULL || 
+               /* .. or if the sub-request envinronment differs from the main-request. */ 
+               r->subprocess_env != r->main->subprocess_env
+       ) {
+               /* setup standard CGI variables */
+               ap_add_common_vars(r);
+               ap_add_cgi_vars(r);
+       }
 
        ctx = SG(server_context);
        if (ctx == NULL) {