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 [url]http://bugs.php.net/?id=25701&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=25701&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=25701&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=25701&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=25701&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=25701&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=25701&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=25701&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=25701&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=25701&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=25701&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=25701&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=25701&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=25701&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=25701&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=25701&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=25701&r=float[/url]