php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #6128 header() does not flush properly
Submitted: 2000-08-12 06:24 UTC Modified: 2000-08-17 04:58 UTC
From: garths at cs dot sfu dot ca Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.1pl2 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
22 - 17 = ?
Subscribe to this entry?

 
 [2000-08-12 06:24 UTC] garths at cs dot sfu dot ca
Calling header("location: *") should immediately send 
the header to the client (Or if not, flush() or something 
similar should force this. Documentation unclear). This 
does not happen. In the following case, the header only 
gets sent once script execution is finished.

header("Location: http://www.blah.com");
flush();

In this case, however, the header gets sent 
immediately.

header("Location: http://www.blah.com");
ECHO " ";
flush();

This surely can't be the expected behaviour, since there 
shouldn't be any body in a redirect header response, 
and there must be a way to send a header immediately 
(I believe it worked in some previous versions).

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-15 11:51 UTC] hholzgra@php.net
headers are collected until the first real (body) output
occurs and then they are sent all at once 

flush() does only work on body output, not headers

as php doesn't know anythnig about HTTP header values
it does not know that there will be no following
output after a "Location:" header

i'll change this one to "feature request" as:

"flush() should process all outstanding headers as if
 real output had occured even if there hasn't been no
 output yet"

although i'm not really sure this is the right thing to do
 [2000-08-17 04:58 UTC] stas@php.net
header() should not immediately send headers, since more headers can follow. All headers are sent in one set when the output of teh script starts.

And this is wrong that redirect can't have a body. It can - and, in fact, even should - for clients that cannot understand redirect code and/or Location: header.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 30 03:01:31 2024 UTC