Skip to content

Instantly share code, notes, and snippets.

/test.php Secret

Created Sep 1, 2016
What would you like to do?
ini_set('session.use_cookies', 1);
ini_set('session.save_handler', 'files');
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']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment