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

[eluser]Twisted1919[/eluser]
$data is an array, you can't base64_encode()/decode() it.
#12

[eluser]guidorossi[/eluser]
Can you paste here an example of the data with this issue?
#13

[eluser]Twisted1919[/eluser]
I can't paste, but i can tell u that it only contains a-z letters and 0-9 and of course spaces, but that's all,
no special char or something like this .

Just as a side note, my logs are full of this error, just ugly.
#14

[eluser]guidorossi[/eluser]
Did you read this? http://ryanbosinger.com/blog/2009/php-un...-solution/

Try that trim() thing...
#15

[eluser]Twisted1919[/eluser]
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 .
#16

[eluser]ChimpWorks[/eluser]
I uploaded Session.php from CI 2.0 and the problem has gone away.
#17

[eluser]Twisted1919[/eluser]
Nope it didn't, there is still the same issue(CI-R-2.0.2)
#18

[eluser]InsiteFX[/eluser]
Did you all update the session table to fix the user_agent field?

user_agent varchar(120)

Otherwise it can not read the session cookie correct.

InsiteFX
#19

[eluser]ChimpWorks[/eluser]
[quote author="InsiteFX" date="1308301608"]Did you all update the session table to fix the user_agent field?

user_agent varchar(120)

Otherwise it can not read the session cookie correct.

InsiteFX[/quote]

No I changed the user_data field to longtext as suggested earlier and uploaded Session.php from CI Reactor but just checked the logs this morning and the errors are still appearing.

I've now changed the user_agent field to varchar(120) so we'll see if that stops it.
#20

[eluser]ChimpWorks[/eluser]
Hmm, actually I can't see why changing the user_agent field to anything other than varchar 50 would make any difference because on line 312 of Session.php the User Agent is being truncated to 50 chars

'user_agent' => substr($this->CI->input->user_agent(), 0, 50),




Theme © iAndrew 2016 - Forum software by © MyBB