Prevent sending multiple Set-Cookie headers #1780

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+10 −9
Split
View
@@ -420,6 +420,11 @@ public function _display($output = '')
}
}
+ if($CI->session) {
@tlianza

tlianza Oct 12, 2014

Seems like line 433 checks if the $CI object exits... so maybe this block should be after that one.

+ // Save the session. If using session cookies, this ensures only one "Set-Cookie" header is sent
+ $CI->session->get_driver()->sess_save();
+ }
+
// --------------------------------------------------------------------
// Does the $CI object exist?
@@ -177,6 +177,11 @@ public function select_driver($driver)
}
}
+ public function get_driver()
+ {
+ return $this->current;
+ }
+
// ------------------------------------------------------------------------
/**
@@ -279,9 +284,6 @@ public function set_userdata($newdata = array(), $newval = '')
$this->userdata[$key] = $val;
}
}
-
- // Tell driver data changed
- $this->current->sess_save();
}
// ------------------------------------------------------------------------
@@ -512,9 +512,6 @@ protected function _sess_create()
// Add empty user_data field and save the data to the DB
$this->CI->db->set('user_data', '')->insert($this->sess_table_name, $this->userdata);
}
-
- // Write the cookie
- $this->_set_cookie();
}
// ------------------------------------------------------------------------
@@ -555,9 +552,6 @@ protected function _sess_update($force = FALSE)
'session_id' => $this->userdata['session_id']
), array('session_id' => $old_sessid));
}
-
- // Write the cookie
- $this->_set_cookie();
}
// ------------------------------------------------------------------------