#45860 [NEW]: header() function fails to correctly replace all Status lines

[email protected] ("overlordq at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             overlordq at gmail dot com
Operating system: Linux x86_64
PHP version:      5.2.6
PHP Bug Type:     CGI related
Bug description:  header() function fails to correctly replace all Status lines

Description:
------------
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.
---

and

---
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:
---------------
http://toolserver.org/~overlordq/results.txt

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.

-- 
Edit bug report at http://bugs.php.net/?id=45860&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45860&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45860&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45860&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45860&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45860&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45860&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45860&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45860&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45860&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45860&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45860&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45860&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45860&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45860&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45860&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45860&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45860&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45860&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45860&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45860&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.