jenssegers / jenssegers/codeigniter-hmvc-modules

CI_Session inconsistency

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
187
Forks
102
PR merge metrics
No merged PRs in 30d

Description

Hello,
first : nice job, these classes were very helpful :+1:
I had a problem with the session class due to its re-instanciation.
Let's say I have a parent controller calling several children controllers (ctrl_a & ctrl_b).
if you load the session library in ctrl_a and set data in it :
`$this->session->set_userdata('arbitrary_key_a','arbitrary_value_a');`
then in the ctrl_b you load session library and once more add data :
`$this->session->set_userdata('arbitrary_key_b','arbitrary_value_b');`
Only the datas saved in ctrl_b will persist because the session library is not a singleton !
So I had to override the CI_Session class, modify the $userdata property and set it to static and force sess_read to merge the cookie's data to the static $userdata array.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.