[HttpFoundation] domain shouldn't be required

Spec says: "The default value of domain is the host name of the server which generated the cookie response."
This commit is contained in:
Jordi Boggiano 2010-07-24 18:26:03 +02:00 committed by Fabien Potencier
parent 02fe129013
commit 6142700881

View File

@ -192,10 +192,6 @@ class HeaderBag
return $this->set('Cookie', $cookie);
}
if (!$domain) {
throw new \InvalidArgumentException('The cookie domain cannot be empty');
}
if (null !== $expires) {
if (is_numeric($expires)) {
$expires = (int) $expires;
@ -211,7 +207,9 @@ class HeaderBag
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5);
}
$cookie .= '; domain='.$domain;
if ($domain) {
$cookie .= '; domain='.$domain;
}
if ('/' !== $path) {
$cookie .= '; path='.$path;