Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NativeSessionStorage.php

function NativeSessionStorage::__construct

Depending on how you want the storage driver to behave you probably want to override this constructor entirely.

List of options for $options array with their defaults.

but we omit 'session.' from the beginning of the keys for convenience.

("auto_start", is not supported as it tells PHP to start a session before PHP starts to execute user-land code. Setting during runtime has no effect).

cache_limiter, "" (use "0" to prevent headers from being sent entirely). cache_expire, "0" cookie_domain, "" cookie_httponly, "" cookie_lifetime, "0" cookie_path, "/" cookie_secure, "" cookie_samesite, null gc_divisor, "100" gc_maxlifetime, "1440" gc_probability, "1" lazy_write, "1" name, "PHPSESSID" referer_check, "" (deprecated since Symfony 7.2, to be removed in Symfony 8.0) serialize_handler, "php" use_strict_mode, "1" use_cookies, "1" use_only_cookies, "1" (deprecated since Symfony 7.2, to be removed in Symfony 8.0) use_trans_sid, "0" (deprecated since Symfony 7.2, to be removed in Symfony 8.0) sid_length, "32" (

Deprecated

since Symfony 7.2, to be removed in 8.0) sid_bits_per_character, "5" (@deprecated since Symfony 7.2, to be removed in 8.0) trans_sid_hosts, $_SERVER['HTTP_HOST'] (deprecated since Symfony 7.2, to be removed in Symfony 8.0) trans_sid_tags, "a=href,area=href,frame=src,form=" (deprecated since Symfony 7.2, to be removed in Symfony 8.0)

See also

https://php.net/session.configuration for options

2 calls to NativeSessionStorage::__construct()
SessionManager::__construct in core/lib/Drupal/Core/Session/SessionManager.php
Constructs a new session manager instance.
SessionManager::__construct in core/lib/Drupal/Core/Session/SessionManager.php
Constructs a new session manager instance.
2 methods override NativeSessionStorage::__construct()
PhpBridgeSessionStorage::__construct in vendor/symfony/http-foundation/Session/Storage/PhpBridgeSessionStorage.php
Depending on how you want the storage driver to behave you probably want to override this constructor entirely.
SessionManager::__construct in core/lib/Drupal/Core/Session/SessionManager.php
Constructs a new session manager instance.

File

vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php, line 76

Class

NativeSessionStorage
This provides a base class for session attribute storage.

Namespace

Symfony\Component\HttpFoundation\Session\Storage

Code

public function __construct(array $options = [], AbstractProxy|\SessionHandlerInterface|null $handler = null, ?MetadataBag $metaBag = null) {
    if (!\extension_loaded('session')) {
        throw new \LogicException('PHP extension "session" is required.');
    }
    $options += [
        'cache_limiter' => '',
        'cache_expire' => 0,
        'use_cookies' => 1,
        'lazy_write' => 1,
        'use_strict_mode' => 1,
    ];
    session_register_shutdown();
    $this->setMetadataBag($metaBag);
    $this->setOptions($options);
    $this->setSaveHandler($handler);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal