Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 8fdbc0d

Browse files
authored
PHP session cookies are no longer broken
When using native PHP sessions with cookies, PHP will set a cookie whenever a session is created or regenerated. Adding an additional `Set-Cookie` header in the same request will cause the PHP `Set-Cookie` header to be lost. Ideally native PHP sessions with cookies should be avoided when using PSR-7 compatible classes, but that is not always possible - this PR makes sure PHP's session cookies are not lost.
1 parent fbcf611 commit 8fdbc0d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Response/SapiEmitterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private function emitHeaders(ResponseInterface $response)
6565
{
6666
foreach ($response->getHeaders() as $header => $values) {
6767
$name = $this->filterHeader($header);
68-
$first = true;
68+
$first = $name === 'Set-Cookie' ? false : true;
6969
foreach ($values as $value) {
7070
header(sprintf(
7171
'%s: %s',

0 commit comments

Comments
 (0)