From 2c7e6d660c817729fb5d23de1fc9af2d65406e73 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 27 Jun 2026 00:01:13 +0200 Subject: [PATCH 1/2] fix(Session): clear session data on destroy in testing environment --- system/Session/Session.php | 2 ++ tests/system/Session/SessionTest.php | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/system/Session/Session.php b/system/Session/Session.php index 1c3824928775..f1901377d0d5 100644 --- a/system/Session/Session.php +++ b/system/Session/Session.php @@ -274,6 +274,8 @@ private function removeOldSessionCookie(): void public function destroy() { if (ENVIRONMENT === 'testing') { + $_SESSION = []; + return; } diff --git a/tests/system/Session/SessionTest.php b/tests/system/Session/SessionTest.php index 3b7cd3860ccd..e66b3f868f97 100644 --- a/tests/system/Session/SessionTest.php +++ b/tests/system/Session/SessionTest.php @@ -328,6 +328,19 @@ public function testSetMagicMethod(): void $this->assertSame('bar', $_SESSION['foo']); } + public function testDestroyClearsSessionInTesting(): void + { + $session = $this->getInstance(); + $session->start(); + + $session->set('foo', 'bar'); + $this->assertSame('bar', $_SESSION['foo']); + + $session->destroy(); + + $this->assertSame([], $_SESSION); + } + public function testCanFlashData(): void { $session = $this->getInstance(); From 538f4970a76ab0a3ff4db678b0110f718872e3b9 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sat, 27 Jun 2026 00:08:22 +0200 Subject: [PATCH 2/2] Chore: trigger CI