Skip to content

Instantly share code, notes, and snippets.

/test.php Secret
Created Sep 1, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.