src/Web/Sessions/Session.php
public function getHasSessionId()
    {
        if ($this->_hasSessionId === null) {
            $name = $this->getName();
            $request = $this->request;
            $cookie = $request->getCookies()->getValue($name);
            if (!empty($cookie) && ini_get('session.use_cookies')) {
                $this->_hasSessionId = true;
                $this->_sessionId = $cookie;
            } elseif (!ini_get('session.use_only_cookies') && ini_get('session.use_trans_sid')) {
                $idFromRequest = $request->get($name);
                $this->_hasSessionId = $idFromRequest != '';
                $this->_sessionId = $idFromRequest != '' ? $idFromRequest : null;
            } else {
                $this->_sessionId = null;
                $this->_hasSessionId = false;
            }
        }

        return $this->_hasSessionId;
    }
public function getHasSessionId()
    {
        if ($this->_hasSessionId === null) {
            $name = $this->getName();
            $request = $this->request;
            $cookie = $request->getCookies()->getValue($name);
            if (!empty($cookie) && ini_get('session.use_cookies')) {
                $this->_hasSessionId = true;
                $this->_sessionId = $cookie;
            } elseif (!ini_get('session.use_only_cookies') && ini_get('session.use_trans_sid')) {
                $idFromRequest = $request->get($name);
                $this->_hasSessionId = $idFromRequest != '';
                $this->_sessionId = $idFromRequest != '' ? $idFromRequest : null;
            } else {
                $this->_sessionId = null;
                $this->_hasSessionId = false;
            }
        }

        return $this->_hasSessionId;
    }
Returns a value indicating whether the current request has sent the session ID.
The default implementation will check cookie and $_GET using the session name.
If you send session ID via other ways, you may need to override this method
or call [[setHasSessionId()]] to explicitly set whether the session ID is sent.
@return bool whether the current request has sent the session ID.