From:             
Operating system: all
PHP version:      5.3.5
Package:          Output Control
Bug Type:         Bug
Bug description:Output Buffer Dumps Data On Error

Description:
------------
When output buffering is turned on (via ob_start()) and an error is
encountered before a call to ob_end_* is called the entire contents of the
output buffer is dumped (to STDOUT) and there appears to be no way to
prevent the buffer from dumping - not even by setting an error handler,
etc.



This is a security issue since the output buffer may contain sensitive
information that is them dumped over to the user. Using set_error_handler
does not stop the dump - it appears the dump simply happens with no way to
intercept or prevent it.

Test script:
---------------
<?php

ob_start();

echo 123;

trigger_error('test error', E_USER_ERROR);

$contents = ob_get_contents();

ob_end_clean();

?>

Expected result:
----------------
(no output)

Actual result:
--------------
123

Fatal error: test error in ...

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

Reply via email to