public function SessionManager::start in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Session/SessionManager.php \Drupal\Core\Session\SessionManager::start()
- 9 core/lib/Drupal/Core/Session/SessionManager.php \Drupal\Core\Session\SessionManager::start()
File
- core/lib/Drupal/Core/Session/SessionManager.php, line 96
Class
- SessionManager
- Manages user sessions.
Namespace
Drupal\Core\Session
Code
public function start() : bool {
if (($this->started || $this->startedLazy) && !$this->closed) {
return $this->started;
}
$request = $this->requestStack
->getCurrentRequest();
$this
->setOptions($this->sessionConfiguration
->getOptions($request));
if ($this->sessionConfiguration
->hasSession($request)) {
$result = $this
->startNow();
}
if (empty($result)) {
$_SESSION = [];
$this
->loadSession();
$this->started = FALSE;
$this->startedLazy = TRUE;
$result = FALSE;
}
return $result;
}