Edit report at https://bugs.php.net/bug.php?id=51367&edit=1
ID: 51367 Comment by: jasper dot mattsson at gmail dot com Reported by: lefevre dot 10 at osu dot edu Summary: flush() doesn't inform headers_sent()'s filename or linenumber values Status: Feedback Type: Bug Package: Output Control PHP Version: 5.2.13 Block user comment: N Private report: N New Comment: Still happens on PHP 5.4.0-3~precise+4 (cli) (built: Mar 27 2012 08:50:50) Previous Comments: ------------------------------------------------------------------------ [2012-02-15 13:44:10] zeusgerde at arcor dot de Same bug for me on Windows 7 for PHP 5.3.10 (can't see a more recent version on Windows snapshot site, only trunk with [0B]) Test script: --------------- <?php error_reporting(E_ALL); ini_set('display_errors', 1); header('Content-Type: text/plain'); flush(); echo phpversion(), "\n"; $file = 'a'; $line = 'b'; if (headers_sent($file, $line)) { var_dump($file, $line); } header('X-Foo: Bar'); Expected result: ---------------- 5.3.10 string(35) "D:\htdocs\test\php\headers_sent.php" int(6) // or 7 for line 7 "flush();" Warning: Cannot modify header information - headers already sent in D:\htdocs\test\php\headers_sent.php on line 17 Actual result: -------------- 5.3.10 string(0) "" int(0) Warning: Cannot modify header information - headers already sent in D:\htdocs\test\php\headers_sent.php on line 17 ------------------------------------------------------------------------ [2010-05-19 14:41:57] m...@php.net Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ headers_sent() after flush() returns FALSE for me. ------------------------------------------------------------------------ [2010-03-23 18:46:36] lefevre dot 10 at osu dot edu Change the '1 = 1' to '$a = 1' in test script ;) ------------------------------------------------------------------------ [2010-03-23 18:43:25] lefevre dot 10 at osu dot edu Description: ------------ If flush() is called, a subsequent call to headers_sent() with $filename and $linenumber specified does not bind the actual file name and line number of the line where flush() appeared. Instead the values are empty string and 0, respectively. Test script: --------------- <? 1 = 1; flush(); if ( headers_sent( $file, $line) ) { echo "Headers sent at $file: $line<br>"; } echo "Some text here.<br>"; if ( headers_sent( $file, $line) ) { echo "Headers sent at $file: $line<br>"; } Expected result: ---------------- Headers sent at '/var/www/flush_test.php', line 5. Some text here. Headers sent at '/var/www/flush_test.php', line 8. Actual result: -------------- Headers sent at '', line 0. Some text here. Headers sent at '/var/www/flush_test.php', line 8. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=51367&edit=1