From:             pitrou at free dot fr
Operating system: Linux
PHP version:      4.3.2
PHP Bug Type:     Output Control
Bug description:  ob_start wrongly optimized out when no callback specified

Description:
------------
Newly with PHP 4.3.2, calls to ob_start with an empty handler (i.e.
ob_start("")) seem to be optimized out and ignored.

This causes two problems :
- ob_start("") can be useful if you prefer to process the
  contents manually by using ob_get_contents() and then
  ob_end_clean()
- nesting of output buffers is broken, because the ob_end()
  call corresponding to ob_start("") is still taken (which
  can totally break the page if your ob_start("") is nested
  inside an ob_start("ob_gzhandler")...)


Reproduce code:
---------------
** This one doesn't work (second statement is eaten out) :

<?php
                                                                          
                                
ob_start("ob_gzhandler");
ob_start("");
echo "first echo<p>";
ob_end_flush();
echo "second echo<p>";
ob_end_flush();
?>

** This one works (both statements are printed) :

<?php
                                                                          
                                
function foo($x) { return $x; }
                                                                          
                                
ob_start("ob_gzhandler");
ob_start("foo");
echo "first echo<p>";
ob_end_flush();
echo "second echo<p>";
ob_end_flush();
?>



Expected result:
----------------
Both programs should have the same result (i.e. print both statements on
screen).


Actual result:
--------------
The program which calls ob_start with an empty handler fails to display
the second statement. In the other program, we circumvent this bug by
using a dummy handler, which causes it to work properly.


-- 
Edit bug report at http://bugs.php.net/?id=24346&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24346&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24346&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24346&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24346&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24346&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24346&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24346&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24346&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24346&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24346&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24346&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24346&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24346&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24346&r=gnused

Reply via email to