#35056 [Com]: Apache2 child crashes if ErrorDocument is PHP script

From: Date: Tue, 01 Nov 2005 20:53:01 +0000
Subject: #35056 [Com]: Apache2 child crashes if ErrorDocument is PHP script
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-87362@lists.php.net to get a copy of this message
ID: 35056 Comment by: sebastian dot harnau at gmx dot de Reported By: margus at zone dot ee Status: Open Bug Type: Reproducible crash Operating System: SuSE Linux 9.0 PHP Version: 4.4.1RC1 New Comment: Same Problem here (SuSE 9.2), Solution works for me, too! Previous Comments: ------------------------------------------------------------------------ [2005-11-01 20:25:57] margus at zone dot ee Description: ------------ I have PHP compiled as apache2handler SAPI and using ErrorDocument, which points to an PHP script. If this ErrorDocument is triggered, then apache child crashes. It must be connected with the bug #33987 and as ironic it is, PHP 4.4.1 Changelog claims, that #33987 is fixed. Bug #33987 is actually reported against PHP5.1 and not against 4.4.0. PHP 4.4.0 works fine with ErrorDocuments. --------- I looked into the apache2handler source (sapi/apache2handler/sapi_apache2.c) and after debugging it was clear, that crash happens on line (538): if (parent_req && strcmp(parent_req->handler, PHP_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SCRIPT)) { If changed to this: if (parent_req && parent_req->handler && strcmp(parent_req->handler, PHP_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SCRIPT)) { then everything's fine and works. The correct extra check is present in 5.1.0 (but for some odd reason not in 4.4.1 and 5.0.5). Reproduce code: --------------- .htaccess --------- ErrorDocument 404 /error.php?status=404 /error.php --------- die( "File Not Found!" ); Expected result: ---------------- File Not Found! Actual result: -------------- Apache2 crashes. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35056&edit=1

« previous php.bugs (#87362) next »