php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76039 header() not sending headers on empty output
Submitted: 2018-03-01 15:26 UTC Modified: 2021-11-14 04:22 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: yunosh@php.net Assigned: cmb (profile)
Status: No Feedback Package: Apache2 related
PHP Version: 7.0.28 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yunosh@php.net
New email:
PHP Version: OS:

 

 [2018-03-01 15:26 UTC] yunosh@php.net
Description:
------------
Not sure if other SAPIs are affected too, but at least I could not reproduce this with PHP's builtin server.

If sending HTTP headers with the header() method, these headers are no longer sent if the HTTP response body is empty. This can be worked around by flush()ing manually.

PHP 7.0.25

Test script:
---------------
header('X-Foo: bar');
// flush();
// echo "foo";
exit;

Expected result:
----------------
HTTP/1.1 200 OK
Date: Thu, 01 Mar 2018 15:24:28 GMT
Server: Apache/2.4.18 (Ubuntu)
X-Foo: bar
Vary: Accept-Encoding
X-Mod-Pagespeed: 1.13.35.2-0
Cache-Control: max-age=0, no-cache
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8


Actual result:
--------------
HTTP/1.1 200 OK
Date: Thu, 01 Mar 2018 15:24:12 GMT
Server: Apache/2.4.18 (Ubuntu)
Cache-Control: max-age=0, no-cache
Content-Length: 0
Content-Type: text/html; charset=UTF-8


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-02 17:11 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-11-02 17:11 UTC] cmb@php.net
I cannot reproduce that with PHP-7.4.  Is this still an issue for
you with any of the actively supported PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-11-14 04:22 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 "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 12:01:27 2024 UTC