Skip to content

Commit 3339e49

Browse files
authored
Cannot change session id when session is active
mezzio#26 Fix provided by https://github.com/jorgeribeiro Signed-off-by: Timo Nußbaum <[email protected]>
1 parent f3408d2 commit 3339e49

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PhpSessionPersistence.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ public function initializeId(SessionInterface $session): SessionInterface
167167
*/
168168
private function startSession(string $id, array $options = []): void
169169
{
170-
session_id($id);
170+
if (!session_id()) { // Check if session is already set beforehand
171+
session_id($id);
172+
}
173+
171174
session_start([
172175
'use_cookies' => false,
173176
'use_only_cookies' => true,

0 commit comments

Comments
 (0)