Fix Session cookie driver storing untrimmed user agent string in the database causing set_userdata() calls to fail when $config['sess_match_useragent'] = TRUE
Signed-off-by: Daniel Robbins <github@danieljrobbins.com>
diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php
index 057e5a1..0e86441 100644
--- a/system/libraries/Session/drivers/Session_cookie.php
+++ b/system/libraries/Session/drivers/Session_cookie.php
@@ -494,7 +494,7 @@
$this->userdata = array(
'session_id' => $this->_make_sess_id(),
'ip_address' => $this->CI->input->ip_address(),
- 'user_agent' => substr($this->CI->input->user_agent(), 0, 120),
+ 'user_agent' => trim(substr($this->CI->input->user_agent(), 0, 120)),
'last_activity' => $this->now,
);