Skip to content

CI_Session inconsistency #16

Description

@n00dl3

Hello,
first : nice job, these classes were very helpful 👍
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions