function DrupalKernel::initializeEphemeralSession

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::initializeEphemeralSession()

Initializes a session backed by in-memory store and puts it on the request.

A simple in-memory store is sufficient for command line tools and tests. Web requests will be processed by the session middleware where the mock session is replaced by a session object backed with persistent storage and a real session handler.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

See also

\Drupal\Core\StackMiddleware\Session::handle()

1 call to DrupalKernel::initializeEphemeralSession()
DrupalKernel::preHandle in core/lib/Drupal/Core/DrupalKernel.php
Helper method that does request related initialization.

File

core/lib/Drupal/Core/DrupalKernel.php, line 1684

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

protected function initializeEphemeralSession(Request $request) : void {
    $session = new Session(new MockArraySessionStorage());
    $session->start();
    $request->setSession($session);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.