Skip to content

Commit 67729f8

Browse files
committed
use the empty string instead of null as an array offset
1 parent e868881 commit 67729f8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ResponseHeaderBag.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function getCacheControlDirective(string $key): bool|string|null
174174
*/
175175
public function setCookie(Cookie $cookie)
176176
{
177-
$this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
177+
$this->cookies[$cookie->getDomain() ?? ''][$cookie->getPath()][$cookie->getName()] = $cookie;
178178
$this->headerNames['set-cookie'] = 'Set-Cookie';
179179
}
180180

@@ -187,13 +187,13 @@ public function removeCookie(string $name, ?string $path = '/', ?string $domain
187187
{
188188
$path ??= '/';
189189

190-
unset($this->cookies[$domain][$path][$name]);
190+
unset($this->cookies[$domain ?? ''][$path][$name]);
191191

192-
if (empty($this->cookies[$domain][$path])) {
193-
unset($this->cookies[$domain][$path]);
192+
if (empty($this->cookies[$domain ?? ''][$path])) {
193+
unset($this->cookies[$domain ?? ''][$path]);
194194

195-
if (empty($this->cookies[$domain])) {
196-
unset($this->cookies[$domain]);
195+
if (empty($this->cookies[$domain ?? ''])) {
196+
unset($this->cookies[$domain ?? '']);
197197
}
198198
}
199199

0 commit comments

Comments
 (0)