From:             cataphract
Operating system: Debian Lenny
PHP version:      5.3.3
Package:          CGI related
Bug Type:         Bug
Bug description:CGI: error_log may result in output before the headers

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 bug report at http://bugs.php.net/bug.php?id=52785&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52785&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52785&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52785&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52785&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52785&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52785&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52785&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52785&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52785&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52785&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52785&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52785&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52785&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52785&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52785&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52785&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52785&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52785&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52785&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52785&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52785&r=mysqlcfg

Reply via email to