[HttpFoundation] Cookie values should not be restricted

This commit is contained in:
Jordi Boggiano 2011-11-23 11:38:46 +01:00
parent 286ce0ea40
commit e06cea9aaa
2 changed files with 0 additions and 28 deletions

View File

@ -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.');
}

View File

@ -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
*/