Issue Bug Closed

#88420HTTP Headers are incorrectly send when using PSR-15 middleware

Markus Poerschke 05/23/19, 08:52 updated 12/23/19, 22:49

Description

When sending HTTP headers, the values of the headers are combined with a comma, if multiple headers exists.

For example this hinders for example, that multiple cookies can be set at the same time.

Example:

Given you have the following code in a middleware

$response = $response->withAddedHeader('Set-Cookie', 'my_session_a=1');
$response = $response->withAddedHeader('Set-Cookie', 'my_session_a=2');

return $response;

The expected output is, that two headers are set:

Set-Cookie: my_session_a=1
Set-Cookie: my_session_b=2

But instead the values are combined:

Set-Cookie: my_session_a=1, my_session_b=2

This behaviors has the impact, that only the “my_session_a” cookie is set. The other is ignored.

Reviews 2