Pull merge.
[yaffs-website] / web / core / lib / Drupal / Core / Session / SessionManager.php
index 607103109dbcc809520b236665fd2ca0b4377670..79813986786bc1567d495d1cc0ba2f63151c2eea 100644 (file)
@@ -218,6 +218,11 @@ class SessionManager extends NativeSessionStorage implements SessionManagerInter
 
     if ($this->isStarted()) {
       $old_session_id = $this->getId();
+      // Save and close the old session. Call the parent method to avoid issue
+      // with session destruction due to the session being considered obsolete.
+      parent::save();
+      // Ensure the session is reloaded correctly.
+      $this->startedLazy = TRUE;
     }
     session_id(Crypt::randomBytesBase64());
 
@@ -230,10 +235,7 @@ class SessionManager extends NativeSessionStorage implements SessionManagerInter
       $this->migrateStoredSession($old_session_id);
     }
 
-    if (!$this->isStarted()) {
-      // Start the session when it doesn't exist yet.
-      $this->startNow();
-    }
+    $this->startNow();
   }
 
   /**