/** * Parses the http set cookie header * * @param string $headerValue The header value with cookie info in it * * @return void */ public function parseCookieHeaderValue($headerValue) { $request = $this->getRequest(); // parse cookies and iterate over foreach (explode(';', $headerValue) as $cookieStr) { // check if cookieStr is no just a empty str if (strlen($cookieStr) > 0) { // add cookie object to request if the cookie string can be parsed properly if ($cookie = HttpCookie::createFromRawSetCookieHeader($cookieStr)) { $request->addCookie($cookie); } } } }
/** * Explicitly destroys all session data and adds a cookie to the * response that invalidates the session in the browser. * * @param string $reason The reason why the session has been destroyed * * @return void */ public function destroy($reason) { // check if the session has already been destroyed if ($this->getId() != null) { // create a new cookie with the session values $cookie = new HttpCookie($this->getName(), $this->getId(), $this->getLifetime(), $this->getMaximumAge(), $this->getDomain(), $this->getPath(), $this->isSecure(), $this->isHttpOnly()); // let the cookie expire $cookie->expire(); // and add it to the response $this->getResponse()->addCookie($cookie); } // reset the requested session ID in the request $this->getRequest()->setRequestedSessionId(null); // destroy the sessions data parent::destroy($reason); }