Fix #20140: Fix compatibility with PHP 8.4: calling session_set_save_handler()

This commit is contained in:
Viktor Khokhryakov
2024-12-06 14:34:47 +04:00
committed by GitHub
parent 5df412df2c
commit 65e3369e16
7 changed files with 106 additions and 31 deletions

View File

@@ -171,7 +171,7 @@ class DbSession extends MultiFieldSession
* Session read handler.
* @internal Do not call this method directly.
* @param string $id session ID
* @return string the session data
* @return string|false the session data, or false on failure
*/
public function readSession($id)
{
@@ -247,15 +247,13 @@ class DbSession extends MultiFieldSession
* Session GC (garbage collection) handler.
* @internal Do not call this method directly.
* @param int $maxLifetime the number of seconds after which data will be seen as 'garbage' and cleaned up.
* @return bool whether session is GCed successfully
* @return int|false the number of deleted sessions on success, or false on failure
*/
public function gcSession($maxLifetime)
{
$this->db->createCommand()
return $this->db->createCommand()
->delete($this->sessionTable, '[[expire]]<:expire', [':expire' => time()])
->execute();
return true;
}
/**