From 2c10f60586faf59b9380608c5a9bf01ff2522483 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 15 Mar 2016 14:39:02 +0200 Subject: Add __isset() to CI_Session --- system/libraries/Session/Session.php | 18 ++++++++++++++++++ user_guide_src/source/changelog.rst | 1 + 2 files changed, 19 insertions(+) diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php index 77c56ae70..c9d2e8adc 100644 --- a/system/libraries/Session/Session.php +++ b/system/libraries/Session/Session.php @@ -583,6 +583,24 @@ class CI_Session { // ------------------------------------------------------------------------ + /** + * __isset() + * + * @param string $key 'session_id' or a session data key + * @return bool + */ + public function __isset($key) + { + if ($key === 'session_id') + { + return (session_status() === PHP_SESSION_ACTIVE); + } + + return isset($_SESSION[$key]); + } + + // ------------------------------------------------------------------------ + /** * __set() * diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index e88b68f85..e235d2e6a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -16,6 +16,7 @@ Bug fixes for 3.0.6 ------------------- - Fixed a bug (#4516) - :doc:`Form Validation Library ` always accepted empty array inputs. +- Fixed a bug where :doc:`Session Library ` allowed accessing ``$_SESSION`` values as class properties but ``isset()`` didn't work on them. Version 3.0.5 ============= -- cgit v1.2.3-24-g4f1b