CodeIgniter Forums

Full Version: $this->session->sess_destroy(); didn't destroy all session?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Alpha[/eluser]
hi, i have $this->session->set_userdata('user_id', 'ID1');

then i want to logout and used $this->session->sess_destroy();
but to my surprise $this->session->set_userdata('user_id', 'ID1') still exist, see below how i used $this->session->sess_destroy();

$this->load->view('index', $data);
$this->session->sess_destroy();

tnx

El Forum

[eluser]WanWizard[/eluser]
It destroys the session, but doesn't empty the userdata array already loaded.

El Forum

[eluser]Alpha[/eluser]
i get it, user_data uses session database and ci session is not like php native session wherein once u run session destroy all data stored in session object will be destroyed

tnx Smile

El Forum

[eluser]Alpha[/eluser]
based on http://ellislab.com/codeigniter/user-gui...sions.html session destroy should destroy all items but why user_data still exist?

El Forum

[eluser]WanWizard[/eluser]
As I said, sess_destroy() doesn't empty the user_data array.

It's a 'bug/feature' that's been there since the beginning of time. If this is a problem for you, either report it to have it fixed, or extend the session class and erase it yourself.