Welcome Guest, Not a member yet? Register   Sign In
Session library and unserialize() error.
#21

[eluser]ChimpWorks[/eluser]
[quote author="Twisted1919" date="1297463407"]Thank you for the resource, it was helpful.
I edited the _serialize() method :
Code:
function _serialize($data)
    {
        if (is_array($data))
        {
            foreach ($data as $key => $val)
            {
                if (is_string($val))
                {
                    $data[$key] = trim(str_replace('\\', '{{slash}}', $val));
                }
            }
        }
        else
        {
            if (is_string($data))
            {
                $data = trim(str_replace('\\', '{{slash}}', $data));
            }
        }

        return trim(serialize($data));
    }
I'll wait to see if there are improvements and i'll let u know of my findings .[/quote]

Did that work for you?
#22

[eluser]InsiteFX[/eluser]
Because the Reactor Team changed the field length on the user_agent but it is not documented in the User Guide! Look at the Session Class and you will see it! If the user_agent like IE goe's over the 50 chars it will not read the cookie!

InsiteFX
#23

[eluser]ChimpWorks[/eluser]
[quote author="InsiteFX" date="1308329033"]Because the Reactor Team changed the field length on the user_agent but it is not documented in the User Guide! Look at the Session Class and you will see it! If the user_agent like IE goe's over the 50 chars it will not read the cookie!

InsiteFX[/quote]

I am looking in the Session class from Reactor 2.0.2 and in the function sess_create() on line 319 the user_agent gets truncated to 50 chars then the data gets written to the database, so my point is it doesn't matter if you increase the varchar limit, there will only ever be 50 chars written. Please tell me if I'm missing something?
#24

[eluser]InsiteFX[/eluser]
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, 120), // <-- See!
    'last_activity' => $this->now
);
#25

[eluser]ChimpWorks[/eluser]
So your suggesting changing it from 50 to 120? but what about user agents longer than 120 there are many?

http://stackoverflow.com/questions/65492...string-get
#26

[eluser]bubbafoley[/eluser]
I'm pretty sure the change to the ua string length was done after 2.0.2 and so technically isn't released yet.

https://bitbucket.org/ellislab/codeignit...c9990d33bc

2.0.2 Session.php: https://bitbucket.org/ellislab/codeignit...php#cl-319
#27

[eluser]ChimpWorks[/eluser]
[quote author="bubbafoley" date="1308339907"]I'm pretty sure the change to the ua string length was done after 2.0.2 and so technically isn't released yet.

https://bitbucket.org/ellislab/codeignit...c9990d33bc

2.0.2 Session.php: https://bitbucket.org/ellislab/codeignit...php#cl-319[/quote]

Thank you for the clarification.

Made the changes so fingers crossed it stops the errors.
#28

[eluser]InsiteFX[/eluser]
Nope! It was done in 2.0.1

Search the forums an you will see all kinds of problems it caused to sessions.

InsiteFX
#29

[eluser]ChimpWorks[/eluser]
I'm still getting these errors:-

ERROR - 2011-06-23 00:09:29 --&gt; Severity: Notice --&gt; unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 81 of 96 bytes /home/l/i/livesite/web/system/libraries/Session.php 714

even after changing the user_agent field to varchar 120. I tend to agree with this post that its bots that are causing the errors...

http://ellislab.com/forums/viewthread/134524/#687483
#30

[eluser]bill19[/eluser]
I got a similar error caused by

Code:
error_reporting(E_ALL | E_STRICT);

when I commented it out, the error went away.

Bill




Theme © iAndrew 2016 - Forum software by © MyBB