Edit report at https://bugs.php.net/bug.php?id=44744&edit=1
ID: 44744
Comment by: space at wechall dot net
Reported by: chsc at peytz dot dk
Summary: apache_response_headers() does not include duplicate
headers
Status: Open
Type: Feature/Change Request
Package: Apache2 related
Operating System: Linux
PHP Version: 5.2.5
Block user comment: N
Private report: N
New Comment:
Also in PHP 5.3.10â¦
i will test it on PHP 5.4 ASAPâ¦
Bug #25173 can be closed as duplicate of thisâ¦
Previous Comments:
------------------------------------------------------------------------
[2008-04-16 16:25:43] chsc at peytz dot dk
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 this bug report at https://bugs.php.net/bug.php?id=44744&edit=1