function SessionConfiguration::getUnprefixedName
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getUnprefixedName()
- 10 core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getUnprefixedName()
- 11.x core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getUnprefixedName()
Returns the session cookie name without the secure/insecure prefix.
@returns string The session name without the prefix (SESS/SSESS).
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
1 call to SessionConfiguration::getUnprefixedName()
- SessionConfiguration::getName in core/
lib/ Drupal/ Core/ Session/ SessionConfiguration.php - Returns the session cookie name.
File
-
core/
lib/ Drupal/ Core/ Session/ SessionConfiguration.php, line 88
Class
- SessionConfiguration
- Defines the default session configuration generator.
Namespace
Drupal\Core\SessionCode
protected function getUnprefixedName(Request $request) {
if ($test_prefix = $this->drupalValidTestUa()) {
$session_name = $test_prefix;
}
elseif (isset($this->options['cookie_domain'])) {
// If the user specifies the cookie domain, also use it for session name.
$session_name = $this->options['cookie_domain'];
}
else {
// Otherwise use $base_url as session name, without the protocol
// to use the same session identifiers across HTTP and HTTPS.
$session_name = $request->getHost() . $request->getBasePath();
// Replace "core" out of session_name so core scripts redirect properly,
// specifically install.php.
$session_name = preg_replace('#/core$#', '', $session_name);
}
return substr(hash('sha256', $session_name), 0, 32);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.