Edit report at http://bugs.php.net/bug.php?id=52785&edit=1
ID: 52785 Updated by: johan...@php.net Reported by: cataphr...@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] cataphr...@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