You are here

public function PdoSessionHandler::close in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::close()

File

vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php, line 386

Class

PdoSessionHandler
Session handler using a PDO connection to read and write data.

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

public function close() {
  $this
    ->commit();
  while ($unlockStmt = array_shift($this->unlockStatements)) {
    $unlockStmt
      ->execute();
  }
  if ($this->gcCalled) {
    $this->gcCalled = false;

    // delete the session records that have expired
    $sql = "DELETE FROM {$this->table} WHERE {$this->lifetimeCol} + {$this->timeCol} < :time";
    $stmt = $this->pdo
      ->prepare($sql);
    $stmt
      ->bindValue(':time', time(), \PDO::PARAM_INT);
    $stmt
      ->execute();
  }
  if (false !== $this->dsn) {
    $this->pdo = null;

    // only close lazy-connection
  }
  return true;
}