Skip to content

Commit a959a78

Browse files
authored
Fix: PHP 8.5 Compatibility – Null Array Offset Deprecation (#188)
2 parents 0b6cdd9 + 95b760f commit a959a78

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Phaseolies/Http/Response/ResponseHeaderBag.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ public function getCacheControlDirective(string $key): bool|string|null
162162

163163
public function setCookie(Cookie $cookie): void
164164
{
165-
$this->cookies[$cookie->getDomain()][$cookie->getPath()][$cookie->getName()] = $cookie;
165+
$domain = $cookie->getDomain() ?? '';
166+
$path = $cookie->getPath() ?? '/';
167+
$name = $cookie->getName();
168+
169+
$this->cookies[$domain][$path][$name] = $cookie;
166170
$this->headerNames['set-cookie'] = 'Set-Cookie';
167171
}
168172

@@ -171,7 +175,8 @@ public function setCookie(Cookie $cookie): void
171175
*/
172176
public function removeCookie(string $name, ?string $path = '/', ?string $domain = null): void
173177
{
174-
$path ??= '/';
178+
$domain = $domain ?? '';
179+
$path = $path ?? '/';
175180

176181
unset($this->cookies[$domain][$path][$name]);
177182

0 commit comments

Comments
 (0)