-
-
Save anonymous/6b4a906273f489e95e2dfac3c247c68c to your computer and use it in GitHub Desktop.
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
ini_set('session.use_cookies', 1); | |
ini_set('session.save_handler', 'files'); | |
session_name('PHPSESSID'); | |
if (!session_start()) { | |
throw new \RuntimeException('Failed to start the session'); | |
} | |
if (isset($_GET['set_cookie'])) { | |
// Emulate Symfony authentication `$session->migrate(true)` | |
if (!session_regenerate_id(true)) { | |
throw new \RuntimeException('Failed to regenerate the session'); | |
} | |
// Emulate Symfony rememberme | |
// Buggy behavior. | |
header(sprintf('Set-Cookie: REMEMBERME=value; expires=Sat, 03-Sep-2020 05:38:43 GMT; path=/; domain=%s; httponly', $_GET['set_cookie'])); | |
// Uncomment to get the right behavior. | |
// setcookie('REMEMBERME', 'value', time() + 12345, '/', $_GET['set_cookie']); | |
} | |
session_write_close(); | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment