Describe the bug
When using the Database Session handler and setting $sessionExpiration to 0 in App.php, all sessions are effectively lost when the garbage collector runs.
CodeIgniter 4 version
Current version (4.0.4)
Affected module(s)
DatabaseHandler
|
return ($this->db->table($this->table)->delete('timestamp < ' . (time() - $maxlifetime))) ? true : $this->fail(); |
Expected behavior, and steps to reproduce if appropriate
This can be seen more easily by setting session.gc_divisor to 1 in php.ini after setting $sessionExpiration to 0. Any stored sessions in the ci_session table are lost after navigating to another CI controller.
Would expect the sessions to stay alive per this:
|
* Setting to 0 (zero) means expire when the browser is closed. |
Not entirely sure how garbage collection should be handled on them, though.
Context
- OS: Windows 10
- Apache 2.4.46
- PHP version 7.3.21
Describe the bug
When using the Database Session handler and setting
$sessionExpirationto 0 in App.php, all sessions are effectively lost when the garbage collector runs.CodeIgniter 4 version
Current version (4.0.4)
Affected module(s)
DatabaseHandler
CodeIgniter4/system/Session/Handlers/DatabaseHandler.php
Line 323 in 6d56d6b
Expected behavior, and steps to reproduce if appropriate
This can be seen more easily by setting
session.gc_divisorto 1 in php.ini after setting$sessionExpirationto 0. Any stored sessions in the ci_session table are lost after navigating to another CI controller.Would expect the sessions to stay alive per this:
CodeIgniter4/app/Config/App.php
Line 173 in 2da3a86
Not entirely sure how garbage collection should be handled on them, though.
Context