[HttpFoundation] Cookie values should not be restricted
This commit is contained in:
parent
286ce0ea40
commit
e06cea9aaa
@ -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.');
|
||||
}
|
||||
|
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user