Fix bug that prevents a clean logout
This commit is contained in:
@@ -64,9 +64,11 @@ class MY_Session extends CI_Session {
|
||||
|
||||
// before continuing, we need to determine if there is any custom data to deal with.
|
||||
foreach (array('session_id', 'user_id', 'ip_address', 'user_agent', 'last_activity') as $val) {
|
||||
if(isset($customUserdata[$val])) {
|
||||
unset($customUserdata[$val]);
|
||||
$cookieUserdata[$val] = $this->userdata[$val];
|
||||
}
|
||||
}
|
||||
|
||||
// did we find any custom data? If not, we turn the empty array into a string
|
||||
if (count($customUserdata) === 0) {
|
||||
@@ -76,6 +78,10 @@ class MY_Session extends CI_Session {
|
||||
$customUserdata = $this->_serialize($customUserdata);
|
||||
}
|
||||
|
||||
if(!isset($this->userdata['user_id'])) {
|
||||
$this->userdata['user_id'] = '';
|
||||
}
|
||||
|
||||
// run the update query
|
||||
$this->CI->db->where('session_id', $this->userdata['session_id']);
|
||||
$this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_id' => $this->userdata['user_id'], 'user_data' => $customUserdata));
|
||||
|
||||
Reference in New Issue
Block a user