{HttpFoundation] [Session] fixed session compatibility with memcached/redis session storage
Per https://bugs.php.net/bug.php?id=61470, and in fixing #7380, the following error occurs when using a Memcache or Redis session store w/ Symfony security: "Authentication exception occurred; redirecting to authentication entry point (A Token was not found in the SecurityContext.)". This patch applies the first fix only if the session store is "files" {HttpFoundation] [Session] fixed session compatibility with memcached/redis session storage Per https://bugs.php.net/bug.php?id=61470, and in fixing #7380, the following error occurs when using a Memcache or Redis session store w/ Symfony security: "Authentication exception occurred; redirecting to authentication entry point (A Token was not found in the SecurityContext.)". This patch applies the first fix only if the session store is "files"
This commit is contained in:
parent
bd4488b5c8
commit
99adcf1f6a
|
@ -208,13 +208,15 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||||
$ret = session_regenerate_id($destroy);
|
$ret = session_regenerate_id($destroy);
|
||||||
|
|
||||||
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
|
// workaround for https://bugs.php.net/bug.php?id=61470 as suggested by David Grudl
|
||||||
session_write_close();
|
if($this->getSaveHandler()->getSaveHandlerName() === 'files') {
|
||||||
if (isset($_SESSION)) {
|
session_write_close();
|
||||||
$backup = $_SESSION;
|
if (isset($_SESSION)) {
|
||||||
session_start();
|
$backup = $_SESSION;
|
||||||
$_SESSION = $backup;
|
session_start();
|
||||||
} else {
|
$_SESSION = $backup;
|
||||||
session_start();
|
} else {
|
||||||
|
session_start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
Reference in New Issue