From ed9b44acb48e82bec48f55bbc1f129e7c4df9f47 Mon Sep 17 00:00:00 2001 From: pyloris Date: Wed, 8 Nov 2023 20:30:15 +0530 Subject: [PATCH] fixed session related methods in Request --- src/Components/Request.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Components/Request.php b/src/Components/Request.php index 7ac26d72..5cfd41cc 100644 --- a/src/Components/Request.php +++ b/src/Components/Request.php @@ -82,12 +82,17 @@ public function cookieKeys() { // get data in $_SESSION : make sure session is started before calling this. public function sessionData($key) { + // make sure session is running + if (session_status == PHP_SESSION_NONE) + session_start(); return isset($_SESSION[$key]) ? $_SESSION[$key] : NULL; } // get all the session keys public function sessionKeys() { + if (session_status == PHP_SESSION_NONE) + session_start(); return array_keys($_SESSION); }