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

Skip to content

Commit 7d7316a

Browse files
committed
Add samesite attribute to session cookie after session migration
1 parent 4bc1cc7 commit 7d7316a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ public function regenerate($destroy = false, $lifetime = null)
222222
// @see https://bugs.php.net/bug.php?id=70013
223223
$this->loadSession();
224224

225+
if (null !== $this->emulateSameSite) {
226+
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
227+
if (null !== $originalCookie) {
228+
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite));
229+
}
230+
}
231+
225232
return $isRegenerated;
226233
}
227234

0 commit comments

Comments
 (0)