|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65791 Mixing header('Status', and other header with int $http_response_code
Submitted: 2013-09-30 17:20 UTC Modified: 2013-10-14 10:54 UTC
From: rainer-phpbugs at 7val dot com Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 5.4.20 OS:
Private report: No CVE-ID: None
 [2013-09-30 17:20 UTC] rainer-phpbugs at 7val dot com
The int $http_response_code for later calls to header() don't update any earlier codes set with header('Status: ???'). The Documentation claims that it "Forces the HTTP response code to the specified value". If header('Status: ...') has not been used beforehand, setting http_response_code works as expected.

Test script:
header('Status: 500 Internat Server Error', true, 500);
header('Status: 200 OK', true, 200);
header('WWW-Authenticate: Basic realm="Access"', true, 401);
/* this would work: header('Status: 401 OK', true, 401); */


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-02 09:25 UTC]
-Type: Bug +Type: Documentation Problem
 [2013-10-02 09:25 UTC]
"Status:" is just a special CGI header and not handled by PHP at all.
 [2013-10-14 10:54 UTC]
-Status: Open +Status: Not a bug
 [2013-10-14 10:54 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Agreed with Mike.

Personally I don't think this is really a problem at all, not even a documentation problem, we do not need to document features that we do not support or have any influence over.

I'm closing this as expected behaviour, drop me a line if you disagree
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 30 13:01:24 2021 UTC