[HttpFoundation] ResponseHeaderBag::clearCookie now accepts secure/httpOnly
This commit is contained in:
parent
71c3a3599c
commit
83f4ac56b1
@ -229,12 +229,14 @@ class ResponseHeaderBag extends HeaderBag
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param string $domain
|
* @param string $domain
|
||||||
|
* @param bool $secure
|
||||||
|
* @param bool $httpOnly
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function clearCookie($name, $path = '/', $domain = null)
|
public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true)
|
||||||
{
|
{
|
||||||
$this->setCookie(new Cookie($name, null, 1, $path, $domain));
|
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,6 +121,15 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertContains("Set-Cookie: foo=deleted; expires=".gmdate("D, d-M-Y H:i:s T", time() - 31536001)."; path=/; httponly", explode("\r\n", $bag->__toString()));
|
$this->assertContains("Set-Cookie: foo=deleted; expires=".gmdate("D, d-M-Y H:i:s T", time() - 31536001)."; path=/; httponly", explode("\r\n", $bag->__toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testClearCookieSecureNotHttpOnly()
|
||||||
|
{
|
||||||
|
$bag = new ResponseHeaderBag(array());
|
||||||
|
|
||||||
|
$bag->clearCookie('foo', '/', null, true, false);
|
||||||
|
|
||||||
|
$this->assertContains("Set-Cookie: foo=deleted; expires=".gmdate("D, d-M-Y H:i:s T", time() - 31536001)."; path=/; secure", explode("\r\n", $bag->__toString()));
|
||||||
|
}
|
||||||
|
|
||||||
public function testReplace()
|
public function testReplace()
|
||||||
{
|
{
|
||||||
$bag = new ResponseHeaderBag(array());
|
$bag = new ResponseHeaderBag(array());
|
||||||
|
Reference in New Issue
Block a user