[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:
parent
02fe129013
commit
6142700881
@ -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;
|
||||
|
Reference in New Issue
Block a user