Welcome Guest, Not a member yet? Register   Sign In
user_agent bug?
#1

[eluser]taschentuch[/eluser]
hi i think i have found a bug:

in the table ci_session is useragent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.4) G
but when i insert the useragent in a other table is it : Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.4) Gecko/20091028 Ubuntu/9.10 (karmic) Firefox/3.5.4

... there a missing a part of the useragent or is it trimmed? when yes.. why?
#2

[eluser]davidbehler[/eluser]
I guess you used the script from the User Guide to create your ci_session table? That means your useragent column is varchar(50) and every string thats bigger than 50 chars is trimmed. You could easily change to column to be TEXT or varchar(200) or whatever you need.
#3

[eluser]taschentuch[/eluser]
hmm no ...

Code:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
  `session_id` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '0',
  `ip_address` varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '0',
  `user_agent` varchar(150) COLLATE utf8_bin NOT NULL,
  `last_activity` int(10) unsigned NOT NULL DEFAULT '0',
  `user_data` text COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

varchar(150)

have found this:

Session.php

Code:
$this->userdata = array(
                            'session_id'     => md5(uniqid($sessid, TRUE)),
                            'ip_address'     => $this->CI->input->ip_address(),
                            'user_agent'     => substr($this->CI->input->user_agent(), 0, 50),
                            'last_activity'    => $this->now
                            );
.
.
.
        if ($this->sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this->CI->input->user_agent(), 0, 50)))

so.. its not a bug its a feature Big Grin

have changed 50 to 150 now
#4

[eluser]davidbehler[/eluser]
The substr part is not needed as far as I can tell. Most database auto-truncate strings that are too long.




Theme © iAndrew 2016 - Forum software by © MyBB