From f99c08987ea93ec9904ed3bd9988604b8de7b342 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Jan 2025 15:09:58 +0100 Subject: [PATCH] fixup! fix(session): Make session encryption more robust Signed-off-by: Christoph Wurst --- lib/private/Session/Internal.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/private/Session/Internal.php b/lib/private/Session/Internal.php index 1be5b9653ba..d342244576e 100644 --- a/lib/private/Session/Internal.php +++ b/lib/private/Session/Internal.php @@ -83,18 +83,23 @@ class Internal extends Session { * @param string $key */ public function remove(string $key) { - if (isset($_SESSION[$key])) { - unset($_SESSION[$key]); + $reopened = $this->reopen(); + unset($_SESSION[$key]); + if ($reopened) { + $this->close(); } } public function clear() { - $this->reopen(); + $reopened = $this->reopen(); $this->invoke('session_unset'); $this->regenerateId(); $this->invoke('session_write_close'); $this->startSession(true); $_SESSION = []; + if ($reopened) { + $this->close(); + } } public function close() {