예제 #1
0
 public function testDeleteCookieHeaderWithoutMatchingDomain()
 {
     $header = array('Set-Cookie' => "foo=bar; domain=foo.com");
     Slim_Http_Util::deleteCookieHeader($header, 'foo', array('domain' => 'bar.com'));
     $this->assertEquals(1, preg_match("@foo=bar; domain=foo\\.com\nfoo=; domain=bar\\.com@", $header['Set-Cookie']));
 }
예제 #2
0
 /**
  * Delete cookie
  *
  * Instead of using PHP's `setcookie()` function, Slim manually constructs the HTTP `Set-Cookie`
  * header on its own and delegates this responsibility to the `Slim_Http_Util` class. This
  * response's header is passed by reference to the utility class and is directly modified. By not
  * relying on PHP's native implementation, Slim allows middleware the opportunity to massage or
  * analyze the raw header before the response is ultimately delivered to the HTTP client.
  *
  * This method will set a cookie with the given name that has an expiration time in the past; this will
  * prompt the HTTP client to invalidate and remove the client-side cookie. Optionally, you may
  * also pass a key/value array as the second argument. If the "domain" key is present in this
  * array, only the Cookie with the given name AND domain will be removed. The invalidating cookie
  * sent with this response will adopt all properties of the second argument.
  *
  * @param   string  $name   The name of the cookie
  * @param   array   $value  Properties for cookie including: value, expire, path, domain, secure, httponly
  */
 public function deleteCookie($name, $value = array())
 {
     Slim_Http_Util::deleteCookieHeader($this->header, $name, $value);
 }