mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #13947 from pascalwoerde/2.cannot-change-save-handler-when-session-is-active
Fix duplicate session_set_save_handler call from handler instantiation.
This commit is contained in:
commit
5eed56b6e4
1 changed files with 11 additions and 9 deletions
|
@ -587,8 +587,9 @@ class CakeSession {
|
||||||
if (!empty($sessionConfig['handler']) && !isset($sessionConfig['handler']['engine'])) {
|
if (!empty($sessionConfig['handler']) && !isset($sessionConfig['handler']['engine'])) {
|
||||||
call_user_func_array('session_set_save_handler', $sessionConfig['handler']);
|
call_user_func_array('session_set_save_handler', $sessionConfig['handler']);
|
||||||
}
|
}
|
||||||
if (!empty($sessionConfig['handler']['engine']) && !headers_sent() && (!function_exists('session_status') || session_status() !== PHP_SESSION_ACTIVE)) {
|
if (!empty($sessionConfig['handler']['engine']) && !headers_sent()) {
|
||||||
$handler = static::_getHandler($sessionConfig['handler']['engine']);
|
$handler = static::_getHandler($sessionConfig['handler']['engine']);
|
||||||
|
if (!function_exists('session_status') || session_status() !== PHP_SESSION_ACTIVE) {
|
||||||
session_set_save_handler(
|
session_set_save_handler(
|
||||||
array($handler, 'open'),
|
array($handler, 'open'),
|
||||||
array($handler, 'close'),
|
array($handler, 'close'),
|
||||||
|
@ -598,6 +599,7 @@ class CakeSession {
|
||||||
array($handler, 'gc')
|
array($handler, 'gc')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Configure::write('Session', $sessionConfig);
|
Configure::write('Session', $sessionConfig);
|
||||||
static::$sessionTime = static::$time;
|
static::$sessionTime = static::$time;
|
||||||
if (!static::$_useForwardsCompatibleTimeout) {
|
if (!static::$_useForwardsCompatibleTimeout) {
|
||||||
|
|
Loading…
Reference in a new issue