codeigniter-hmvc-modules icon indicating copy to clipboard operation
codeigniter-hmvc-modules copied to clipboard

CI_Session inconsistency

Open n00dl3 opened this issue 11 years ago • 0 comments

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.

n00dl3 avatar Nov 26 '14 11:11 n00dl3