/** * Explicitly destroys all session data * * @param string $reason A reason for destroying the session – used by the LoggingAspect * @return void * @throws \TYPO3\Flow\Session\Exception * @throws \TYPO3\Flow\Session\Exception\SessionNotStartedException * @api */ public function destroy($reason = null) { if ($this->started !== true) { throw new \TYPO3\Flow\Session\Exception\SessionNotStartedException('Tried to destroy a session which has not been started yet.', 1351162668); } if ($this->remote !== true) { if (!$this->response->hasCookie($this->sessionCookieName)) { $this->response->setCookie($this->sessionCookie); } $this->sessionCookie->expire(); } $this->removeSessionMetaDataCacheEntry($this->sessionIdentifier); $this->storageCache->flushByTag($this->storageIdentifier); $this->started = false; $this->sessionIdentifier = null; $this->storageIdentifier = null; $this->tags = array(); $this->request = null; }
/** * Data provider with cookies and their expected string representation. * * @return array */ public function cookiesAndTheirStringRepresentations() { $expiredCookie = new Cookie('foo', 'bar'); $expiredCookie->expire(); return array(array(new Cookie('foo', 'bar'), 'foo=bar; Path=/; HttpOnly'), array(new Cookie('MyFoo25', 'bar'), 'MyFoo25=bar; Path=/; HttpOnly'), array(new Cookie('MyFoo25', TRUE), 'MyFoo25=1; Path=/; HttpOnly'), array(new Cookie('MyFoo25', FALSE), 'MyFoo25=0; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 0), 'foo=bar; Path=/; HttpOnly'), array(new Cookie('MyFoo25'), 'MyFoo25=; Path=/; HttpOnly'), array(new Cookie('foo', 'It\'s raining cats and dogs.'), 'foo=It%27s+raining+cats+and+dogs.; Path=/; HttpOnly'), array(new Cookie('foo', 'Some characters, like "double quotes" must be escaped.'), 'foo=Some+characters%2C+like+%22double+quotes%22+must+be+escaped.; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 1345108546), 'foo=bar; Expires=Thu, 16-Aug-2012 09:15:46 GMT; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', \DateTime::createFromFormat('U', 1345108546)), 'foo=bar; Expires=Thu, 16-Aug-2012 09:15:46 GMT; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'flow.typo3.org'), 'foo=bar; Domain=flow.typo3.org; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'flow.typo3.org', '/about'), 'foo=bar; Domain=flow.typo3.org; Path=/about; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'typo3.org', '/', TRUE), 'foo=bar; Domain=typo3.org; Path=/; Secure; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'typo3.org', '/', TRUE, FALSE), 'foo=bar; Domain=typo3.org; Path=/; Secure'), array(new Cookie('foo', 'bar', 0, 3600), 'foo=bar; Max-Age=3600; Path=/; HttpOnly'), array($expiredCookie, 'foo=bar; Expires=Thu, 27-May-1976 12:00:00 GMT; Path=/; HttpOnly')); }