diff options
author | Andrey Andreev <narf@devilix.net> | 2016-03-15 13:39:02 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-03-15 13:39:02 +0100 |
commit | 2c10f60586faf59b9380608c5a9bf01ff2522483 (patch) | |
tree | e5481cbc7c28b20919258033f07f2f4c39aa52f0 | |
parent | a990a8d195a13dd38bdd1620391a4e1b40770952 (diff) |
Add __isset() to CI_Session
-rw-r--r-- | system/libraries/Session/Session.php | 18 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 19 insertions, 0 deletions
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 @@ -584,6 +584,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() * * @param string $key Session data key 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 <libraries/form_validation>` always accepted empty array inputs. +- Fixed a bug where :doc:`Session Library <libraries/sessions>` allowed accessing ``$_SESSION`` values as class properties but ``isset()`` didn't work on them. Version 3.0.5 ============= |