Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d28949b

Browse files
[HttpFoundation] don't encode cookie name for BC
1 parent 601cc08 commit d28949b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,17 @@ public function sendHeaders()
333333
}
334334

335335
// headers
336-
foreach ($this->headers->allPreserveCase() as $name => $values) {
336+
foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
337337
foreach ($values as $value) {
338338
header($name.': '.$value, false, $this->statusCode);
339339
}
340340
}
341341

342+
// cookies
343+
foreach ($this->headers->getCookies() as $cookie) {
344+
header('Set-Cookie: '.$cookie->getName().strstr($cookie, '='), false, $this->statusCode);
345+
}
346+
342347
// status
343348
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
344349

src/Symfony/Component/HttpFoundation/Tests/Fixtures/response-functional/cookie_urlencode.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Array
44
[0] => Content-Type: text/plain; charset=utf-8
55
[1] => Cache-Control: no-cache, private
66
[2] => Date: Sat, 12 Nov 1955 20:04:00 GMT
7-
[3] => Set-Cookie: %3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
7+
[3] => Set-Cookie: ?*():@&+$/%#[]=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
88
[4] => Set-Cookie: ?*():@&+$/%#[]=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/
99
)
1010
shutdown

0 commit comments

Comments
 (0)