From: chsc at peytz dot dk
Operating system: Linux
PHP version: 5.2.5
PHP Bug Type: Apache2 related
Bug description: apache_response_headers() does not include duplicate headers
Description:
------------
When multiple response headers with the same name are set using
header(..., false), only the last value is returned by
apache_response_headers().
apache_response_headers() returns an associative array, so it cannot have
multiple entries for the same header name. However, according to section
4.2 of RFC 2616, multiple headers with the same name may be combined into
one comma-separated header.
It MUST be possible to combine the multiple header fields into
one "field-name: field-value" pair, without changing the semantics
of the message, by appending each subsequent field-value to the
first, each separated by a comma.
I suggest that apache_response_headers() does this, i.e. combines multiple
headers with comma.
Reproduce code:
---------------
header('Foo: 1');
header('Foo: 2', false);
header('Foo: 3', false);
var_dump(apache_response_headers());
Expected result:
----------------
array(2) {
["X-Powered-By"]=>
string(9) "PHP/5.2.5"
["Foo"]=>
string(1) "1,2,3"
}
Actual result:
--------------
array(2) {
["X-Powered-By"]=>
string(9) "PHP/5.2.5"
["Foo"]=>
string(1) "3"
}
--
Edit bug report at http://bugs.php.net/?id=44744&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44744&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44744&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44744&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44744&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44744&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44744&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44744&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44744&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44744&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44744&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44744&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44744&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44744&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44744&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44744&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44744&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44744&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44744&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44744&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44744&r=mysqlcfg