ID: 25701
Updated by: [email]sniperphp.net[/email]
Reported By: scottmacvicar at ntlworld dot com
-Status: Open
+Status: Assigned
Bug Type: Apache2 related
Operating System: *
PHP Version: 4CVS
-Assigned To:
+Assigned To: iliaa
New Comment:

Ilia, don't forget this.



Previous Comments:
------------------------------------------------------------------------

[2003-10-01 10:30:57] scottmacvicar at ntlworld dot com

<?php

ob_start();

echo 'test';
flush();

$newtext = ob_get_clean();

if (!headers_sent())
{
echo 'in here<br />';
}

echo $newtext;

?>

Based on what you've said above then you shouldn't see 'in here' within
Apache 2.

------------------------------------------------------------------------

[2003-09-30 19:22:16] scottmacvicar at ntlworld dot com

Shouldn't headers_sent() return true then?

------------------------------------------------------------------------

[2003-09-30 18:47:05] [email]iliaaphp.net[/email]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the doentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]

Unlike Apache 1, when Apache 2 recieves a directive to flush it does so
right away sending any pending headers in the process. Since the
headers & text were already sent it cannot send the header indicating
the data that follows in gziped. Due to the missing header you get a
whole bunch of binary data.

------------------------------------------------------------------------

[2003-09-30 09:56:26] scottmacvicar at ntlworld dot com

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 this bug report at [url]http://bugs.php.net/?id=25701&edit=1[/url]