function Session::handle
Same name in other branches
- 9 core/lib/Drupal/Core/StackMiddleware/Session.php \Drupal\Core\StackMiddleware\Session::handle()
- 8.9.x core/lib/Drupal/Core/StackMiddleware/Session.php \Drupal\Core\StackMiddleware\Session::handle()
- 11.x core/lib/Drupal/Core/StackMiddleware/Session.php \Drupal\Core\StackMiddleware\Session::handle()
File
-
core/
lib/ Drupal/ Core/ StackMiddleware/ Session.php, line 45
Class
- Session
- Wrap session logic around a HTTP request.
Namespace
Drupal\Core\StackMiddlewareCode
public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) : Response {
// Initialize and start a session for web requests. Command line tools and
// the parent site in functional tests must continue to use the ephemeral
// session initialized and started in DrupalKernel::preHandle().
if ($type === self::MAIN_REQUEST && PHP_SAPI !== 'cli') {
$this->initializePersistentSession($request);
}
$result = $this->httpKernel
->handle($request, $type, $catch);
if ($type === self::MAIN_REQUEST && !$result instanceof ResponseKeepSessionOpenInterface && PHP_SAPI !== 'cli') {
$request->getSession()
->save();
}
return $result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.