Welcome Guest, Not a member yet? Register   Sign In
$this->session->sess_destroy(); didn't destroy all session?

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);


It destroys the session, but doesn't empty the userdata array already loaded.

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

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

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.

Theme © iAndrew 2016 - Forum software by © MyBB