diff options
author | Jordan Eldredge <jordaneldredge@gmail.com> | 2013-12-23 20:10:51 +0100 |
---|---|---|
committer | Jordan Eldredge <jordaneldredge@gmail.com> | 2013-12-23 20:10:51 +0100 |
commit | 5306cad2e40596a3a6fcac787e54689a7095e769 (patch) | |
tree | ddd9065b1f79180e65423d71fa5b5348e988b413 /system | |
parent | 5d6b9c597a9870f55a65bcfcb301d19d83447078 (diff) |
Remove _serialize() and _unserialize() methods
Since removing the unneeded manual escaping code, there is no-longer any reason
to have the serialization functions abstracted. This also allows us to only
suppress errors when unserializing cookie data, and only trim when we are
unserializing database data (see commit 6b8312).
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Session/drivers/Session_cookie.php | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php index 124e0098e..dc75d8e8e 100644 --- a/system/libraries/Session/drivers/Session_cookie.php +++ b/system/libraries/Session/drivers/Session_cookie.php @@ -397,7 +397,7 @@ class CI_Session_cookie extends CI_Session_driver { } // Unserialize the session array - $session = $this->_unserialize($session); + $session = @unserialize($session); // Is the session data we unserialized an array with the correct format? if ( ! is_array($session) OR ! isset($session['session_id'], $session['ip_address'], $session['user_agent'], $session['last_activity'])) @@ -472,7 +472,7 @@ class CI_Session_cookie extends CI_Session_driver { $row = $query->row(); if ( ! empty($row->user_data)) { - $custom_data = $this->_unserialize($row->user_data); + $custom_data = unserialize(trim($row->user_data)); if (is_array($custom_data)) { @@ -608,7 +608,7 @@ class CI_Session_cookie extends CI_Session_driver { if ( ! empty($userdata)) { // Serialize the custom data array so we can store it - $set['user_data'] = $this->_serialize($userdata); + $set['user_data'] = serialize($userdata); } // Reset query builder values. @@ -696,7 +696,7 @@ class CI_Session_cookie extends CI_Session_driver { : $this->userdata; // Serialize the userdata for the cookie - $cookie_data = $this->_serialize($cookie_data); + $cookie_data = serialize($cookie_data); if ($this->sess_encrypt_cookie === TRUE) { @@ -737,36 +737,6 @@ class CI_Session_cookie extends CI_Session_driver { // ------------------------------------------------------------------------ /** - * Serialize an array - * - * This function serializes an array - * - * @param mixed Data to serialize - * @return string Serialized data - */ - protected function _serialize($data) - { - return serialize($data); - } - - // ------------------------------------------------------------------------ - - /** - * Unserialize - * - * This function unserializes a data string - * - * @param mixed Data to unserialize - * @return mixed Unserialized data - */ - protected function _unserialize($data) - { - return @unserialize(trim($data)); - } - - // ------------------------------------------------------------------------ - - /** * Garbage collection * * This deletes expired session rows from database |