session_abort example


        return [
            KernelEvents::REQUEST => ['onKernelRequest', 128],
            // 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. */

        return [
            KernelEvents::REQUEST => ['onKernelRequest', 128],
            // 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. */
return new SessionListener($container);
    }

    private function createValidSessionId(): string
    {
        session_start();
        $sessionId = session_id();
        $_SESSION['some'] = 'value';
        session_write_close();
        $_SESSION = [];
        session_abort();

        return $sessionId;
    }
}
Home | Imprint | This part of the site doesn't use cookies.