8000 [HttpFoundation] Use the correct syntax for session gc based on Pdo driver by tanasecosminromeo · Pull Request #25922 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix bug #25665 - Use the correct syntax for session gc based on Pdo d…
…river

The initial fix for #24456 was wrong, since it only accounted for Postgres. @WhiteEagle88 correctly identified #25665 - but having time as SIGNED is ... off, since time shouldn't be negative. Using CAST to solve this issue surely has a performance penalty, so I believe the best approach is to have a switch based on the driver.
  • Loading branch information
tanasecosminromeo committed Jan 25, 2018
commit 847f114d413be35986f7f543286b3ec1ec238c17
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,13 @@ public function close()
$this->gcCalled = false;

// delete the session records that have expired
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
switch ($this->driver) {
case 'mysql':
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";
break;
default:
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
}

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