Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DrupalKernel.php

function 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 1688

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal