Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Cache / Context / SessionCacheContext.php
index c8b102717d53ebf42b9ba791032e75582778663b..bccd0f01a4690d6f2bc5136820c8612ac6d0e145 100644 (file)
@@ -22,8 +22,11 @@ class SessionCacheContext extends RequestStackCacheContextBase {
    * {@inheritdoc}
    */
   public function getContext() {
-    $sid = $this->requestStack->getCurrentRequest()->getSession()->getId();
-    return Crypt::hashBase64($sid);
+    $request = $this->requestStack->getCurrentRequest();
+    if ($request->hasSession()) {
+      return Crypt::hashBase64($request->getSession()->getId());
+    }
+    return 'none';
   }
 
 }