bug #25398 [HttpFoundation] don't prefix cookies with "Set-Cookie:" (pableu)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation] don't prefix cookies with "Set-Cookie:"

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | ?
| Fixed tickets | #25393
| License       | MIT

Commits
-------

a4db20f [HttpFoundation] don't prefix cookies with "Set-Cookie:"
This commit is contained in:
Nicolas Grekas 2017-12-08 15:02:33 +01:00
commit ec4a160f0e
3 changed files with 38 additions and 1 deletions

View File

@ -156,7 +156,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess
if ($sessionCookieFound) {
header_remove('Set-Cookie');
foreach ($otherCookies as $h) {
header('Set-Cookie:'.$h, false);
header($h, false);
}
} else {
setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly'));

View File

@ -0,0 +1,24 @@
open
validateId
read
doRead: abc|i:123;
read
updateTimestamp
close
open
validateId
read
doRead: abc|i:123;
read
write
destroy
doDestroy
close
Array
(
[0] => Content-Type: text/plain; charset=utf-8
[1] => Cache-Control: max-age=10800, private, must-revalidate
[2] => Set-Cookie: abc=def
)
shutdown

View File

@ -0,0 +1,13 @@
<?php
require __DIR__.'/common.inc';
setcookie('abc', 'def');
session_set_save_handler(new TestSessionHandler('abc|i:123;'), false);
session_start();
session_write_close();
session_start();
$_SESSION['abc'] = 234;
unset($_SESSION['abc']);