ID: 30264 Updated by: [EMAIL PROTECTED] Reported By: mpn at illearth dot net -Status: Open +Status: Bogus Bug Type: Output Control Operating System: Win NT(2K) PHP Version: 4.3.9 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php What makes you think headers should have been sent at the point where you call headers_sent()? I would not expect this to happen until the ob_end_flush() call. Previous Comments: ------------------------------------------------------------------------ [2004-09-28 18:33:41] mpn at illearth dot net Description: ------------ When checking the value of headers_sent(), function is returning FALSE even though headers have clearly been sent. Returned result does not change when output buffering is commented out or where output buffering is started (i.e before sending headers or after ). I crammed the test code into 19 lines, so please excuse the formatting. ["SERVER_SOFTWARE"]=> string(31) "Apache/2.0.49 (Win32) PHP/4.3.9" using sapi Reproduce code: --------------- <?php ob_clean(); if ( stristr( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) ) { ob_start( 'compressOutput' ); } else { ob_start(); } header( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); header( 'Cache-Control: no-store, no-cache, must-revalidate' ); header( 'Cache-Control: post-check=0, pre-check=0', FALSE ); header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); header( 'Pragma: no-cache' ); echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n\n"; echo '<html><head>' . "\n";echo '<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />' . "\n";echo '<meta http-equiv="content-language" content="en-GB" />' . "\n"; echo '</head><body>headers_sent() Returned Value Is: ' . "\n"; var_dump( headers_sent() ); echo '</body></html>' . "\n"; ob_end_flush(); function compressOutput( $str ) { $_output = gzencode( $str ); if ( (bool)FALSE === $_output ) { return $str; } header( 'Content-Encoding: gzip' ); return $_output; } // End Function compressOutput ?> Expected result: ---------------- var_dump( headers_sent() ); = (bool)true Actual result: -------------- var_dump( headers_sent() ); = (bool)false ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30264&edit=1