From: scottmacvicar at ntlworld dot com Operating system: Windows XP SP1 PHP version: 4CVS-2003-09-30 (stable) PHP Bug Type: Apache2 related Bug description: Calling flush from within an output buffer prevents headers from being sent
Description: ------------ Calling flush in Apache and Apache 2 produce different results. Within Apache after calling flush you can still send headers as the output buffer prevents it from actually being flushed. Within Apache 2 after calling flush you can no longer send headers even though headers_sent still returns false. Reproduce code: --------------- <?php ob_start(); echo 'test'; flush(); $newtext = ob_get_clean(); if (strpos(' ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false AND !headers_sent()) { header('Content-Encoding: gzip'); $newtext = gzencode($newtext, 1); } header('Content-Length: ' . strlen($newtext)); echo $newtext; ?> Expected result: ---------------- test Actual result: -------------- binary data -- Edit bug report at http://bugs.php.net/?id=25701&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25701&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25701&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25701&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25701&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25701&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25701&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25701&r=support Expected behavior: http://bugs.php.net/fix.php?id=25701&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25701&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25701&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25701&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25701&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25701&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25701&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25701&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25701&r=float