Bug #52785 [Opn->Bgs]: CGI: error_log may result in output before the headers
| From: | johannes@php.net | Date: | Mon, 06 Sep 2010 22:14:53 +0000 |
| Subject: | Bug #52785 [Opn->Bgs]: CGI: error_log may result in output before the headers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-154126@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52785&edit=1
ID: 52785
Updated by: johannes@php.net
Reported by: cataphract@php.net
Summary: CGI: error_log may result in output before the
headers
-Status: Open
+Status: Bogus
Type: Bug
Package: CGI related
Operating System: Debian Lenny
PHP Version: 5.3.3
Block user comment: N
New Comment:
PHP sends error_log() data via STDERR. RFC 3875 specifies the exact
rules as system-dependent, PHP chose to use only STDOUT for CGI
communication.
Previous Comments:
------------------------------------------------------------------------
[2010-09-06 18:27:50] cataphract@php.net
Description:
------------
A call to error_log may result in data being output before the headers,
thereby corrupting the response.
The same doesn't happen with other PHP output functions.
The ini directive error_log is set to "no value". The docs say "If this
directive is not set, errors are sent to the SAPI error logger".
Test script:
---------------
<?php
error_log("oops");
echo "content";
inexistent_function(); //fatal; no problem
Expected result:
----------------
X-Powered-By: PHP/5.3.3
Content-type: text/html
oops
content<br />
<b>Fatal error</b>: Call to undefined function inexistent_function() in
<b>/home/glopes/test.php</b> on line <b>4</b><br />
Actual result:
--------------
$ /opt/php5/bin/php-cgi test.php
oops
X-Powered-By: PHP/5.3.3
Content-type: text/html
content<br />
<b>Fatal error</b>: Call to undefined function inexistent_function() in
<b>/home/glopes/test.php</b> on line <b>4</b><br />
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52785&edit=1