Skip to content

Commit 99b9c78

Browse files
committed
[HttpFoundation] Reload the session after regenerating its id
1 parent eda5cb1 commit 99b9c78

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,13 @@ public function regenerate($destroy = false, $lifetime = null)
203203
$this->metadataBag->stampNew();
204204
}
205205

206-
return session_regenerate_id($destroy);
206+
$isRegenerated = session_regenerate_id($destroy);
207+
208+
// The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
209+
// @see https://bugs.php.net/bug.php?id=70013
210+
$this->loadSession();
211+
212+
return $isRegenerated;
207213
}
208214

209215
/**

0 commit comments

Comments
 (0)