#35056 [Opn->Csd]: Apache2 child crashes if ErrorDocument is PHP script
| From: | iliaa@php.net | Date: | Tue, 01 Nov 2005 21:07:10 +0000 |
| Subject: | #35056 [Opn->Csd]: Apache2 child crashes if ErrorDocument is PHP script | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-87365@lists.php.net to get a copy of this message | ||
ID: 35056
Updated by: iliaa@php.net
Reported By: margus at zone dot ee
-Status: Open
+Status: Closed
Bug Type: Reproducible crash
Operating System: SuSE Linux 9.0
PHP Version: 4.4.1RC1
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-11-01 21:53:00] sebastian dot harnau at gmx dot de
Same Problem here (SuSE 9.2), Solution works for me, too!
------------------------------------------------------------------------
[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