SessionHandler::read

public SessionHandler::read($sid)

Reads the session data.

Parameters

string $sessionId Session ID, see http://php.net/function.session-id:

Return value

string Same session data as passed in write() or empty string when non-existent or on failure

Overrides SessionHandlerInterface::read

See also

http://php.net/sessionhandlerinterface.read

File

core/lib/Drupal/Core/Session/SessionHandler.php, line 56

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;
}
doc_Drupal
2016-10-29 09:42:02
Comments
Leave a Comment

Please login to continue.