From e06cea9aaabab1cc112c9f6bd4c855ab66235fcf Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 23 Nov 2011 11:38:46 +0100 Subject: [PATCH] [HttpFoundation] Cookie values should not be restricted --- .../Component/HttpFoundation/Cookie.php | 4 ---- .../Component/HttpFoundation/CookieTest.php | 24 ------------------- 2 files changed, 28 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Cookie.php b/src/Symfony/Component/HttpFoundation/Cookie.php index 8392812ebe..0511162aa6 100644 --- a/src/Symfony/Component/HttpFoundation/Cookie.php +++ b/src/Symfony/Component/HttpFoundation/Cookie.php @@ -48,10 +48,6 @@ class Cookie throw new \InvalidArgumentException(sprintf('The cookie name "%s" contains invalid characters.', $name)); } - if (preg_match("/[,; \t\r\n\013\014]/", $value)) { - throw new \InvalidArgumentException(sprintf('The cookie value "%s" contains invalid characters.', $value)); - } - if (empty($name)) { throw new \InvalidArgumentException('The cookie name cannot be empty.'); } diff --git a/tests/Symfony/Tests/Component/HttpFoundation/CookieTest.php b/tests/Symfony/Tests/Component/HttpFoundation/CookieTest.php index 35c06de482..e0eb73a88d 100644 --- a/tests/Symfony/Tests/Component/HttpFoundation/CookieTest.php +++ b/tests/Symfony/Tests/Component/HttpFoundation/CookieTest.php @@ -36,20 +36,6 @@ class CookieTest extends \PHPUnit_Framework_TestCase ); } - public function invalidValues() - { - return array( - array(",MyValue"), - array(";MyValue"), - array(" MyValue"), - array("\tMyValue"), - array("\rMyValue"), - array("\nMyValue"), - array("\013MyValue"), - array("\014MyValue"), - ); - } - /** * @dataProvider invalidNames * @expectedException InvalidArgumentException @@ -60,16 +46,6 @@ class CookieTest extends \PHPUnit_Framework_TestCase new Cookie($name); } - /** - * @dataProvider invalidValues - * @expectedException InvalidArgumentException - * @covers Symfony\Component\HttpFoundation\Cookie::__construct - */ - public function testInstantiationThrowsExceptionIfCookieValueContainsInvalidCharacters($value) - { - new Cookie('MyCookie', $value); - } - /** * @expectedException InvalidArgumentException */