-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #29094 Add samesite attribute to session cookie after session mig…
…ration (rpkamp) This PR was merged into the 4.2-dev branch. Discussion ---------- Add samesite attribute to session cookie after session migration | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29092 | License | MIT | Doc PR | N/A Commits ------- df90300 Add samesite attribute to session cookie after session migration
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...ttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
open | ||
validateId | ||
read | ||
doRead: | ||
read | ||
destroy | ||
close | ||
open | ||
validateId | ||
read | ||
doRead: | ||
read | ||
|
||
write | ||
doWrite: foo|s:3:"bar"; | ||
close | ||
Array | ||
( | ||
[0] => Content-Type: text/plain; charset=utf-8 | ||
[1] => Cache-Control: max-age=0, private, must-revalidate | ||
[2] => Set-Cookie: sid=random_session_id; path=/; secure; HttpOnly; SameSite=lax | ||
) | ||
shutdown |
15 changes: 15 additions & 0 deletions
15
...ent/HttpFoundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
require __DIR__.'/common.inc'; | ||
|
||
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; | ||
|
||
$storage = new NativeSessionStorage(array('cookie_samesite' => 'lax')); | ||
$storage->setSaveHandler(new TestSessionHandler()); | ||
$storage->start(); | ||
|
||
$_SESSION = array('foo' => 'bar'); | ||
|
||
$storage->regenerate(true); | ||
|
||
ob_start(function ($buffer) { return preg_replace('~_sf2_meta.*$~m', '', str_replace(session_id(), 'random_session_id', $buffer)); }); |