39 $generalOptions = $sessionConfig[
'handlers'][
'general'];
40 $generalHandler = $this->buildSessionHandlerByOptions($generalOptions[
'type'], $generalOptions);
42 if ($sessionConfig[
'mode'] === self::MODE_DEFAULT)
44 $this->session =
new Session($generalHandler);
47 elseif ($sessionConfig[
'mode'] === self::MODE_SEPARATED)
49 if (empty($sessionConfig[
'handlers'][
'kernel']))
53 if (empty($sessionConfig[
'handlers'][
'general']))
57 if ($sessionConfig[
'handlers'][
'kernel'] !==
'encrypted_cookies')
59 throw new NotSupportedException(
'Invalid settings. Kernel session works only with "encrypted_cookies"');
62 $this->session =
new Session($generalHandler);
63 $this->kernelSession =
new KernelSession($sessionConfig[
'lifetime'] ?? 0);
64 Legacy\LazySessionStart::register();
65 $this->session->enableLazyStart();
66 if (!empty($sessionConfig[
'debug']))
68 $this->session->enableDebug();
70 $debugger = $this->session->getDebugger();
71 $debugger->setMode($sessionConfig[
'debug']);
72 $debugger->storeConfig($sessionConfig);
76 if (isset($sessionConfig[
'ignoreSessionStartErrors']) && $sessionConfig[
'ignoreSessionStartErrors'] ===
true)
78 $this->session->enableIgnoringSessionStartErrors();
84 if (defined(
"BX_SECURITY_SESSION_VIRTUAL") && BX_SECURITY_SESSION_VIRTUAL ===
true)
87 'mode' => self::MODE_DEFAULT,
94 $sessionConfig = $this->configuration::getValue(
"session") ?: [];
95 $saveHandlerFromIni = ini_get(
'session.save_handler');
96 if ((!$sessionConfig || $sessionConfig === [
'mode' => self::MODE_DEFAULT]) && $saveHandlerFromIni !==
'files')
100 'mode' => self::MODE_DEFAULT,
107 $sessionConfig[
'mode'] = $sessionConfig[
'mode'] ?? self::MODE_DEFAULT;
108 $sessionConfig[
'handlers'][
'general'] = $this->normalizeSessionOptions($sessionConfig[
'handlers'][
'general'] ?? [
'type' => self::TYPE_FILE]);
110 if (defined(
"BX_FORCE_DISABLE_SEPARATED_SESSION_MODE") && BX_FORCE_DISABLE_SEPARATED_SESSION_MODE ===
true)
112 $sessionConfig[
'mode'] = self::MODE_DEFAULT;
115 return $sessionConfig;