Skip to content

Commit 22b0390

Browse files
committed
wip: fix session cookie access
1 parent 0d07afe commit 22b0390

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Dispatch/Dispatcher.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ private function handleSession():void {
159159
}
160160

161161
$sessionConfig = $this->config->getSection("session");
162-
$sessionId = $this->globals["_COOKIE"][$sessionConfig["name"]] ?? null;
162+
163+
// Temporarily allow superglobal access to _COOKIE.
164+
$originalCookie = $_COOKIE;
165+
$_COOKIE = $this->globals["_COOKIE"];
166+
167+
$sessionId = $_COOKIE[$sessionConfig["name"]] ?? null;
163168
$sessionSetup = new SessionSetup();
164169
$sessionHandler = $sessionSetup->attachHandler(
165170
$sessionConfig->getString("handler")
@@ -171,6 +176,8 @@ private function handleSession():void {
171176
$sessionId,
172177
);
173178
$this->serviceContainer->set($session);
179+
180+
$_COOKIE = $originalCookie;
174181
}
175182

176183

0 commit comments

Comments
 (0)