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:
Mark Story 2019-11-28 16:56:04 -05:00 committed by GitHub
commit 5eed56b6e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -587,8 +587,9 @@ class CakeSession {
if (!empty($sessionConfig['handler']) && !isset($sessionConfig['handler']['engine'])) {
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']);
if (!function_exists('session_status') || session_status() !== PHP_SESSION_ACTIVE) {
session_set_save_handler(
array($handler, 'open'),
array($handler, 'close'),
@ -598,6 +599,7 @@ class CakeSession {
array($handler, 'gc')
);
}
}
Configure::write('Session', $sessionConfig);
static::$sessionTime = static::$time;
if (!static::$_useForwardsCompatibleTimeout) {