Skip to content
Snippets Groups Projects
Commit e4e8f314 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2422257 by chx: Remove unnecessary query against the session table in WebTestBase.

parent 56ad560a
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -711,9 +711,17 @@ protected function drupalUserIsLoggedIn($account) {
if (!isset($account->session_id)) {
return FALSE;
}
// The session ID is hashed before being stored in the database.
// @see \Drupal\Core\Session\SessionHandler::read()
return (bool) db_query("SELECT sid FROM {users_field_data} u INNER JOIN {sessions} s ON u.uid = s.uid AND u.default_langcode = 1 WHERE s.sid = :sid", array(':sid' => Crypt::hashBase64($account->session_id)))->fetchField();
$session_id = $account->session_id;
$request_stack = $this->container->get('request_stack');
$request = $request_stack->getCurrentRequest();
$cookies = $request->cookies->all();
foreach ($this->cookies as $name => $value) {
$cookies[$name] = $value['value'];
}
$request_stack->push($request->duplicate(NULL, NULL, NULL, $cookies));
$logged_in = (bool) $this->container->get('session_manager')->getSaveHandler()->read($session_id);
$request_stack->pop();
return $logged_in;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment