function Session::initializePersistentSession
Same name in other branches
- 11.x core/lib/Drupal/Core/StackMiddleware/Session.php \Drupal\Core\StackMiddleware\Session::initializePersistentSession()
Initializes a session backed by persistent store and puts it on the request.
Sessions for web requests need to be backed by a persistent session store and a real session handler (responsible for session cookie management). In contrast, a simple in-memory store is sufficient for command line tools and tests. Hence, the persistent session should only ever be placed on web requests while command line tools and the parent site in functional tests must continue to use the ephemeral session initialized in DrupalKernel::preHandle().
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
See also
\Drupal\Core\DrupalKernel::preHandle()
1 call to Session::initializePersistentSession()
- Session::handle in core/
lib/ Drupal/ Core/ StackMiddleware/ Session.php
File
-
core/
lib/ Drupal/ Core/ StackMiddleware/ Session.php, line 78
Class
- Session
- Wrap session logic around a HTTP request.
Namespace
Drupal\Core\StackMiddlewareCode
protected function initializePersistentSession(Request $request) : void {
/** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $session */
$session = ($this->sessionClosure)();
$session->start();
$request->setSession($session);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.