File
- drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php, line 127
Class
- PdoSessionHandler
- PdoSessionHandler.
Namespace
Symfony\Component\HttpFoundation\Session\Storage\Handler
Code
public function read($id) {
$dbTable = $this->dbOptions['db_table'];
$dbDataCol = $this->dbOptions['db_data_col'];
$dbIdCol = $this->dbOptions['db_id_col'];
try {
$sql = "SELECT {$dbDataCol} FROM {$dbTable} WHERE {$dbIdCol} = :id";
$stmt = $this->pdo
->prepare($sql);
$stmt
->bindParam(':id', $id, \PDO::PARAM_STR);
$stmt
->execute();
$sessionRows = $stmt
->fetchAll(\PDO::FETCH_NUM);
if (count($sessionRows) == 1) {
return base64_decode($sessionRows[0][0]);
}
$this
->createNewSession($id);
return '';
} catch (\PDOException $e) {
throw new \RuntimeException(sprintf('PDOException was thrown when trying to read the session data: %s', $e
->getMessage()), 0, $e);
}
}