#25701 [Opn->Fbk]: Calling flush from within an output buffer prevents headers from being sent
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 14:19:15 +0000 |
| Subject: | #25701 [Opn->Fbk]: Calling flush from within an output buffer prevents headers from being sent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-48318@lists.php.net to get a copy of this message | ||
ID: 25701
Updated by: sniper@php.net
Reported By: scottmacvicar at ntlworld dot com
-Status: Open
+Status: Feedback
Bug Type: Apache2 related
Operating System: Windows XP SP1
PHP Version: 4CVS-2003-09-30 (stable)
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/?id=25701&edit=1