diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 9774735..9b947ca 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -141,6 +141,7 @@ function install_drupal($class_loader, $settings = array()) { // installations can send output to the browser or redirect the user to the // next page. if ($state['interactive']) { + // If a session has been initiated in this request, make sure to save it. if ($session = \Drupal::request()->getSession()) { $session->save(); } @@ -1555,6 +1556,8 @@ function install_load_profile(&$install_state) { * Performs a full bootstrap of Drupal during installation. */ function install_bootstrap_full() { + // Store the session on the request object and start it. + /** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $session */ $session = \Drupal::service('session'); \Drupal::request()->setSession($session); $session->start(); diff --git a/core/lib/Drupal/Core/Session/SessionHandler.php b/core/lib/Drupal/Core/Session/SessionHandler.php index d8b3789..4c1f685 100644 --- a/core/lib/Drupal/Core/Session/SessionHandler.php +++ b/core/lib/Drupal/Core/Session/SessionHandler.php @@ -62,12 +62,10 @@ public function read($sid) { if (empty($sid)) { return ''; } - else { - // Read the session data from the database. - $query = $this->connection - ->queryRange('SELECT session FROM {sessions} WHERE sid = :sid', 0, 1, ['sid' => Crypt::hashBase64($sid)]); - return (string) $query->fetchField(); - } + // Read the session data from the database. + $query = $this->connection + ->queryRange('SELECT session FROM {sessions} WHERE sid = :sid', 0, 1, ['sid' => Crypt::hashBase64($sid)]); + return (string) $query->fetchField(); } /** diff --git a/core/modules/user/src/EventSubscriber/UserRequestSubscriber.php b/core/modules/user/src/EventSubscriber/UserRequestSubscriber.php index 2dd73b0..6f35a2b 100644 --- a/core/modules/user/src/EventSubscriber/UserRequestSubscriber.php +++ b/core/modules/user/src/EventSubscriber/UserRequestSubscriber.php @@ -65,9 +65,9 @@ public function onKernelTerminate(PostResponseEvent $event) { * {@inheritdoc} */ public static function getSubscribedEvents() { - // Should go before other subscribers start to write their caches. And - // specifically before \Drupal\Core\EventSubscriber\KernelDestructionSubscriber - // to prevent instantiation of destructed services. + // Should go before other subscribers start to write their caches. Notably + // before \Drupal\Core\EventSubscriber\KernelDestructionSubscriber to + // prevent instantiation of destructed services. $events[KernelEvents::TERMINATE][] = ['onKernelTerminate', 300]; return $events; }