session_unset example

// low priority to come after regular response listeners             KernelEvents::RESPONSE => ['onKernelResponse', -1000],
        ];
    }

    public function reset(): void
    {
        if (\PHP_SESSION_ACTIVE === session_status()) {
            session_abort();
        }

        session_unset();
        $_SESSION = [];

        if (!headers_sent()) { // session id can only be reset when no headers were so we check for headers_sent first             session_id('');
        }
    }

    /** * Gets the session object. */
    abstract protected function getSession(): ?SessionInterface;

    
// low priority to come after regular response listeners             KernelEvents::RESPONSE => ['onKernelResponse', -1000],
        ];
    }

    public function reset(): void
    {
        if (\PHP_SESSION_ACTIVE === session_status()) {
            session_abort();
        }

        session_unset();
        $_SESSION = [];

        if (!headers_sent()) { // session id can only be reset when no headers were so we check for headers_sent first             session_id('');
        }
    }

    /** * Gets the session object. */
    abstract protected function getSession(): ?SessionInterface;

    
Home | Imprint | This part of the site doesn't use cookies.