function SessionConfiguration::getOptions

Same name in other branches
  1. 9 core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getOptions()
  2. 8.9.x core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getOptions()
  3. 10 core/lib/Drupal/Core/Session/SessionConfiguration.php \Drupal\Core\Session\SessionConfiguration::getOptions()

Overrides SessionConfigurationInterface::getOptions

File

core/lib/Drupal/Core/Session/SessionConfiguration.php, line 48

Class

SessionConfiguration
Defines the default session configuration generator.

Namespace

Drupal\Core\Session

Code

public function getOptions(Request $request) {
    $options = $this->options;
    // Generate / validate the cookie domain.
    $options['cookie_domain'] = $this->getCookieDomain($request) ?: '';
    // If the site is accessed via SSL, ensure that the session cookie is
    // issued with the secure flag.
    $options['cookie_secure'] = $request->isSecure();
    // Set the session cookie name.
    $options['name'] = $this->getName($request);
    if (\PHP_VERSION_ID >= 80400) {
        // See https://wiki.php.net/rfc/deprecations_php_8_4#sessionsid_length_and_sessionsid_bits_per_character
        unset($options['sid_length'], $options['sid_bits_per_character']);
    }
    return $options;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.