CodeIgniter Forums
Session userdata unsetting if too many variables are set...? Help Please - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Session userdata unsetting if too many variables are set...? Help Please (/showthread.php?tid=32388)



Session userdata unsetting if too many variables are set...? Help Please - El Forum - 07-21-2010

[eluser]bryantAXS[/eluser]
So I'm using Redux Auth on my site for user authentication, and I'm running into an issue when I'm setting data pulled from the DB as session data. After the session data is set in the Login controller, I can successfully echo out the session data; however, after I redirect to the authenticated page, the session data is clear and nothing is set. When I remove some of the properties, the session is pulled successfully on the later end of the redirect.

I know there is a 4K limit on the cookie size used for the sessions, but is this amount of data 4K? To be honest I'm not sure what 4K of plain-text looks like, but this seems pretty low.

This is the userdata array before the redirect, which does not remained set after the redirect.

Code:
array(
['session_id'] =>'53b0be1ec8af787d22713d98c8645984'
['ip_address'] =>0.0.0.0
['user_agent'] =>'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en'
['last_activity'] =>1279766546
['id'] =>9
['username'] =>'b'
['email'] =>'[email protected]'
['iconId'] =>8
['iconName'] =>'profileIcon_9.png')

Any thoughts or suggestions?

Thanks in advance!


Session userdata unsetting if too many variables are set...? Help Please - El Forum - 07-22-2010

[eluser]InsiteFX[/eluser]
Use database sessions!

InsiteFX


Session userdata unsetting if too many variables are set...? Help Please - El Forum - 07-22-2010

[eluser]bryantAXS[/eluser]
I actually was using DB sessions and I didn't realize it.

When I'm looking at the log file I'm getting an error in the Session library, that says its having problem unserializing the data. Do you see anything wrong with that array I'm using up top?

ERROR - 2010-07-22 08:44:58 --&gt; Severity: Notice --&gt; unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 97 of 100 bytes /Users/bryanthughes/Sites/steerio/system/libraries/Session.php 708


Session userdata unsetting if too many variables are set...? Help Please - El Forum - 07-22-2010

[eluser]bryantAXS[/eluser]
Here is the serialized string its throwing a fit over:

a:5:{s:8:"iconName";s:17:"profileIcon_9.png";s:2:"id";s:1:"9";s:8:"username";s:1:"b";s:5:"email";s:7


Session userdata unsetting if too many variables are set...? Help Please - El Forum - 07-22-2010

[eluser]bryantAXS[/eluser]
Well I'm an idiot and I figured it out... the field in my db that was storing this data was too short and not letting the entire string get set
:red:


Session userdata unsetting if too many variables are set...? Help Please - El Forum - 07-22-2010

[eluser]InsiteFX[/eluser]
You can change the session user_data field to from text to longtext
if you need more space.

InsiteFX


Session userdata unsetting if too many variables are set...? Help Please - El Forum - 08-31-2010

[eluser]Unknown[/eluser]
If you use MSSQL and a TEXT field for user_data don't forget to change PHP.INI settings.

default length in php.ini for a TEXT field is 4096 and not 8192 or more


Session userdata unsetting if too many variables are set...? Help Please - El Forum - 08-31-2010

[eluser]qwang[/eluser]
[quote author="castor007" date="1283282075"]If you use MSSQL and a TEXT field for user_data don't forget to change PHP.INI settings.

default length in php.ini for a TEXT field is 4096 and not 8192 or more[/quote]

i found this property is closed default, but i found the information in the phpinfo() output
so where php get the default value?
thank you