Fix bug with session library generating multiple sessions on ajax requests

This commit is contained in:
Eike Foken
2011-09-19 22:05:54 +02:00
parent 347ea4416e
commit cc594f8a42

View File

@@ -118,7 +118,13 @@ class MY_Session extends CI_Session {
} }
$oldSessionId = $this->userdata['session_id']; $oldSessionId = $this->userdata['session_id'];
// don't change the session ID on ajax requests
if ($this->CI->input->is_ajax_request()) {
$newSessionId = $oldSessionId;
} else {
$newSessionId = $this->generateHash(); $newSessionId = $this->generateHash();
}
// update the session data in the session data array // update the session data in the session data array
$this->userdata['session_id'] = $newSessionId; $this->userdata['session_id'] = $newSessionId;