public function SessionManager::getId in Drupal 9
File
- core/
lib/ Drupal/ Core/ Session/ SessionManager.php, line 132
Class
- SessionManager
- Manages user sessions.
Namespace
Drupal\Core\SessionCode
public function getId() {
$id = parent::getId();
if (empty($id)) {
// Legacy code might rely on the existence of a session ID before a real
// session exists. In this case, generate a random session ID to provide
// backwards compatibility.
@trigger_error('Calling ' . __METHOD__ . '() outside of an actual existing session is deprecated in drupal:9.2.0 and will be removed in drupal:10.0.0. This is often used for anonymous users. See https://www.drupal.org/node/3006306', E_USER_DEPRECATED);
$id = Crypt::randomBytesBase64();
$this
->setId($id);
}
return $id;
}