Welcome Guest, Not a member yet? Register   Sign In
Object in session in MY_Controller clears the session completely.
#1

[eluser]dakipro[/eluser]
Hi, I noticed some strange behavior with latest version of CI2 (2.0.2).
I have MY_Controller that I want to use to pre-load some stuff for each controller, and when I put this in its __constructor()

Code:
$this->session->set_userdata('arrayData',$someArray);


All works fine if that array contains strings or ints or whatever, but if that array contains some objects, all that was in session up to this point gets blank, and array with objects is populated in session as expected.
It took me hours to track this down, I tried to use session in DB, I tried to encrypt it and all works fine with this array with objects, but it deletes all userdata that was in session up to this point.
I can try whatever you suggest, I can post all relevant code that might be needed, but if someone can try to replicate this on their own and confirm that would be awesome. Perhaps this is known bug, but I wasn't able to google it out.
I didn't try to put this code on some other places I just put it in MY_Controller, in its constructor (as that is where I need it, for all controllers).
Thanks in advance,
Dalibor


Messages In This Thread
Object in session in MY_Controller clears the session completely. - by El Forum - 05-16-2011, 12:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB