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

Breadcrumb

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

function AbstractSessionHandler::destroy

3 calls to AbstractSessionHandler::destroy()
AbstractSessionHandler::write in vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php
StrictSessionHandler::destroy in vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php
StrictSessionHandler::destroy in vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php
1 method overrides AbstractSessionHandler::destroy()
StrictSessionHandler::destroy in vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php

File

vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php, line 87

Class

AbstractSessionHandler
This abstract session handler provides a generic implementation of the PHP 7.0 SessionUpdateTimestampHandlerInterface, enabling strict and lazy session handling.

Namespace

Symfony\Component\HttpFoundation\Session\Storage\Handler

Code

public function destroy(string $sessionId) : bool {
    if (!headers_sent() && filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOL)) {
        if (!isset($this->sessionName)) {
            throw new \LogicException(\sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', static::class));
        }
        $cookie = SessionUtils::popSessionCookie($this->sessionName, $sessionId);
        
        /*
         * We send an invalidation Set-Cookie header (zero lifetime)
         * when either the session was started or a cookie with
         * the session name was sent by the client (in which case
         * we know it's invalid as a valid session cookie would've
         * started the session).
         */
        if (null === $cookie || isset($_COOKIE[$this->sessionName])) {
            $params = session_get_cookie_params();
            unset($params['lifetime']);
            setcookie($this->sessionName, '', $params);
        }
    }
    return $this->newSessionId === $sessionId || $this->doDestroy($sessionId);
}

API Navigation

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