[HttpFoundation] Use the correct syntax for session gc based on Pdo driver

This commit is contained in:
Cosmin-Romeo TANASE 2018-01-25 06:29:19 +00:00 committed by Fabien Potencier
parent 4f47bb73a0
commit 826dfbd496

View File

@ -375,7 +375,11 @@ class PdoSessionHandler implements \SessionHandlerInterface
$this->gcCalled = false;
// delete the session records that have expired
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
if ('mysql' === $this->driver) {
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";
} else {
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
}
$stmt = $this->pdo->prepare($sql);
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);