|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45860 header() function fails to correctly replace all Status lines
Submitted: 2008-08-19 08:40 UTC Modified: 2008-09-02 13:22 UTC
From: overlordq at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 5.2CVS, 5.3CVS, 6CVS (2008-08-19) OS: *
Private report: No CVE-ID: None
 [2008-08-19 08:40 UTC] overlordq at gmail dot com
From the documentation:

There are two special-case header calls. The first is a header that starts with the string "HTTP/" (case is not significant), which will be used to figure out the HTTP status code to send.


The optional replace  parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace [...]

But as can be seen below, header fails to replace headers in all cases.

Reproduce code:

Actual result:
As can be seen in the code linked above, header only truly replaces a similar header in the case if the Status is 200, for every other status code (that I've tested) PHP will output a duplicate header which does not conform to CGI spec.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-02 13:22 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 23:01:31 2024 UTC