diff --git a/system/Session/Handlers/DatabaseHandler.php b/system/Session/Handlers/DatabaseHandler.php index 9d3ba2436897..b327ed3335d4 100644 --- a/system/Session/Handlers/DatabaseHandler.php +++ b/system/Session/Handlers/DatabaseHandler.php @@ -196,7 +196,7 @@ public function write($id, $data): bool 'data' => $this->prepareData($data), ]; - if (! $this->db->table($this->table)->set('timestamp', $this->now(), false)->insert($insertData)) { + if (! $this->db->table($this->table)->set('timestamp', 'CURRENT_TIMESTAMP', false)->insert($insertData)) { return $this->fail(); } @@ -218,7 +218,7 @@ public function write($id, $data): bool $updateData['data'] = $this->prepareData($data); } - if (! $builder->set('timestamp', $this->now(), false)->update($updateData)) { + if (! $builder->set('timestamp', 'CURRENT_TIMESTAMP', false)->update($updateData)) { return $this->fail(); } @@ -307,20 +307,13 @@ protected function releaseLock(): bool /** * Determines which NOW function to use based on DBDriver - * + * * @param string $interval Amount of time to subtract from NOW */ - private function now($interval = null): string + private function now($interval): string { $DBDriver = config(Database::class)->{$this->DBGroup}['DBDriver']; - return null === $interval - ? match($DBDriver) - { - 'SQLite3' => "datetime('now')", - default => "now()", - } - : match($DBDriver) - { + return match($DBDriver) { 'SQLite3' => "datetime('now', '-{$interval}')", default => "now() - INTERVAL {$interval}", };