You are here

public function SessionHandler::read in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Session/SessionHandler.php \Drupal\Core\Session\SessionHandler::read()

File

core/lib/Drupal/Core/Session/SessionHandler.php, line 61
Contains \Drupal\Core\Session\SessionHandler.

Class

SessionHandler
Default session handler.

Namespace

Drupal\Core\Session

Code

public function read($sid) {
  $data = '';
  if (!empty($sid)) {

    // Read the session data from the database.
    $query = $this->connection
      ->queryRange('SELECT session FROM {sessions} WHERE sid = :sid', 0, 1, [
      ':sid' => Crypt::hashBase64($sid),
    ]);
    $data = (string) $query
      ->fetchField();
  }
  return $data;
}