8000 [HttpFoundation] Use the correct syntax for session gc based on Pdo d… · symfony/symfony@826dfbd · GitHub
[go: up one dir, main page]

Skip to content

Commit 826dfbd

Browse files
tanasecosminromeofabpot
authored andcommitted
[HttpFoundation] Use the correct syntax for session gc based on Pdo driver
1 parent 4f47bb7 commit 826dfbd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,11 @@ public function close()
375375
$this->gcCalled = false;
376376

377377
// delete the session records that have expired
378-
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
378+
if ('mysql' === $this->driver) {
379+
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";
380+
} else {
381+
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
382+
}
379383

380384
$stmt = $this->pdo->prepare($sql);
381385
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);

0 commit comments

Comments
 (0)
0