php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51367 flush() doesn't inform headers_sent()'s filename or linenumber values
Submitted: 2010-03-23 18:43 UTC Modified: 2013-02-18 00:34 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lefevre dot 10 at osu dot edu Assigned:
Status: No Feedback Package: Output Control
PHP Version: 5.2.13 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lefevre dot 10 at osu dot edu
New email:
PHP Version: OS:

 

 [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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-23 18:46 UTC] lefevre dot 10 at osu dot edu
Change the '1 = 1' to '$a = 1' in test script ;)
 [2010-05-19 14:41 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2010-05-19 14:41 UTC] mike@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.
 [2012-02-15 13:44 UTC] 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
 [2012-04-16 08:56 UTC] jasper dot mattsson at gmail dot com
Still happens on

PHP 5.4.0-3~precise+4 (cli) (built: Mar 27 2012 08:50:50)
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC