From 2173c86b859895ae2e75526fa7760a148b837b8e Mon Sep 17 00:00:00 2001 From: Kyrian Obikwelu Date: Wed, 25 Jun 2025 23:40:22 +0100 Subject: [PATCH] fix(cache): handle missing session in index for CacheSessionHandler Improves `read()` logic in CacheSessionHandler to gracefully handle cases where the session is cleared or missing in the session index. --- src/Session/CacheSessionHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Session/CacheSessionHandler.php b/src/Session/CacheSessionHandler.php index 88f54ab..abfda22 100644 --- a/src/Session/CacheSessionHandler.php +++ b/src/Session/CacheSessionHandler.php @@ -27,7 +27,7 @@ public function __construct( public function read(string $sessionId): string|false { $session = $this->cache->get($sessionId, false); - if ($session === false) { + if ($session === false || !isset($this->sessionIndex[$sessionId])) { return false; }