Skip to content

Commit f3424a5

Browse files
Fix GC issue when session lifetime is set to 0
* fix #4169 GC processing issues when session lifetime is 0 * Added description about the structure of the session library of the document. * Apply suggestions from code review Co-authored-by: John Paul E. Balandan, CPA <51850998+paulbalandan@users.noreply.github.com>
1 parent 26e0025 commit f3424a5

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

system/Session/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ protected function configure()
306306

307307
if (! isset($this->sessionExpiration)) {
308308
$this->sessionExpiration = (int) ini_get('session.gc_maxlifetime');
309-
} else {
309+
} elseif ($this->sessionExpiration > 0) {
310310
ini_set('session.gc_maxlifetime', (string) $this->sessionExpiration);
311311
}
312312

user_guide_src/source/libraries/sessions.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,12 @@ Preference Default Opti
458458
unexpected results or be changed in the future. Please configure
459459
everything properly.
460460

461+
.. note:: If ``sessionExpiration`` is set to ``0``, the ``session.gc_maxlifetime``
462+
setting set by PHP in session management will be used as-is
463+
(often the default value of ``1440``). This needs to be changed in
464+
``php.ini`` or via ``ini_set()`` as needed.
465+
466+
461467
In addition to the values above, the cookie and native drivers apply the
462468
following configuration values shared by the :doc:`IncomingRequest </incoming/incomingrequest>` and
463469
:doc:`Security <security>` classes:

0 commit comments

Comments
 (0)