From: foobar Date: Fri, 11 Jul 2003 04:24:11 +0000 (+0000) Subject: MFH: Fixed bug #21074 (Apache2: "ErrorDocument xxx /error.php" broken). X-Git-Tag: php-4.3.3RC2~136 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=894e2f15f04dd37de7e109eb5e75e85a16f6c76d;p=php MFH: Fixed bug #21074 (Apache2: "ErrorDocument xxx /error.php" broken). --- diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index f201983d54..677e89e1f1 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -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, diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 81ea318130..5e64c5161c 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -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) {