|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-03-23 18:43 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 17:00:01 2025 UTC |
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