public function startHTTPSession()
    {
        // @codeCoverageIgnoreStart
        // Safety measure - can't test this without replacing PHP
        if (session_status() === PHP_SESSION_DISABLED)
            throw new \RuntimeException("Sesssions are disabled");
        // @codeCoverageIgnoreEnd

        if (session_status() === PHP_SESSION_ACTIVE)
            throw new \LogicException("Repeated session initialization");

        // Now do the PHP session magic to initialize the $_SESSION array
        session_set_cookie_params(
            $this->lifetime, 
            $this->session_cookie->getPath(),
            $this->session_cookie->getDomain(),
            $this->session_cookie->getSecure(),
            $this->session_cookie->getHTTPOnly()
        );
        session_name($this->session_cookie->getName());

        $custom_session_id = defined('WEDETO_TEST') && WEDETO_TEST === 1 && $this->session_id !== null;
        if ($custom_session_id)
        {
            ini_set('session.use_strict_mode', 0);
            session_id($this->session_id);
        }
            
        session_start();

        if ($custom_session_id)
            ini_set('session.use_strict_mode', 1);

        // Store the session ID
        $this->session_id = session_id();

        // Make sure the session data is accessible through this object
        $this->values = &$_SESSION;

        // Check if session was regenerated
        $this->secureSession();

        // PHPs sessions do not renew the cookie, so it will expire after the
        // period set when the session was first created. We want to postpone
        // the session expiry at every request, so force a cookie to be sent.
        // As the session_id is available after the session started, we need to
        // update the cookie that was generated in the constructor.
        $this->session_cookie->setValue(session_id());

        // Session has been started
        $this->active = true;

        return $this;
    }