From 91cba25cd3d79f78c3eb12e86b2b551fae80f247 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 18 Aug 2005 01:15:53 +0000 Subject: [PATCH] MFH: Fixed bug #33987 (php script as ErrorDocument causes crash in Apache 2). --- NEWS | 2 ++ sapi/apache2handler/sapi_apache2.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index 1d8ccda05c..c4fec4d8eb 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ PHP 4 NEWS - Fixed bug #34064 (arr[] as param to function is allowed only if function receives argument by reference). (Dmitry) - Fixed bug #33989 (extract($GLOBALS,EXTR_REFS) crashes PHP). (Dmitry) +- Fixed bug #33987 (php script as ErrorDocument causes crash in Apache 2). + (Ilia) - Fixed bug #33940 (array_map() fails to pass by reference when called recursively). (Dmitry) - Fixed bug #33690 (Crash setting some ini directives in httpd.conf). (Rasmus) diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 809abdf46b..6fd3dae561 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -527,6 +527,7 @@ static int php_handler(request_rec *r) zend_first_try { if (ctx == NULL) { +normal: brigade = apr_brigade_create(r->pool, r->connection->bucket_alloc); ctx = SG(server_context); ctx->brigade = brigade; @@ -536,6 +537,11 @@ zend_first_try { } } else { parent_req = ctx->r; + /* check if comming due to ErrorDocument */ + if (parent_req != HTTP_OK) { + parent_req = NULL; + goto normal; + } ctx->r = r; brigade = ctx->brigade; } -- 2.50.1