• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MySQL Session Data Changes in CI V3

#1
Hello,

In CI V2 user session data was stored in MySQL as a TEXT type that was encoded by PHP's serialize().

In CI V3 user session data is now stored in MySQL as a BLOB type and the data is encoded in a
serialize()-like manner, but isn't quite serialize() data. Here is an example:

Code:
__ci_last_regenerate|i:1426712200;user_id|s:1:"1";user_email|s:22:"[email protected]";user_admin|i:1;user_auth|b:1;

I'm trying to connect to MySQL directly, read in that data, and convert it back into PHP values. Any suggestions for how I can parse this data in CI V3? I've tried to hunt down how CI is encoding this data, but can't seem to find it in the library.

Any help would be greatly appreciated.

Note: I know it sounds crazy that I am trying to read in and parse session data directly but I assure you it's for a good reason.
Reply

#2
The session library uses PHP's native session handling (via session_set_save_handler()), so the method used to serialize the data is most likely based on your server's configuration: http://php.net/manual/en/session.configu...ze-handler
Reply

#3
(03-19-2015, 09:35 AM)HelloHow  can i convert this code into array? aaron33 Wrote: Hello,

In CI V2 user session data was stored in MySQL as a TEXT type that was encoded by PHP's serialize().

In CI V3 user session data is now stored in MySQL as a BLOB type and the data is encoded in a
serialize()-like manner, but isn't quite serialize() data. Here is an example:


Code:
__ci_last_regenerate|i:1426712200;user_id|s:1:"1";user_email|s:22:"[email protected]";user_admin|i:1;user_auth|b:1;

I'm trying to connect to MySQL directly, read in that data, and convert it back into PHP values. Any suggestions for how I can parse this data in CI V3? I've tried to hunt down how CI is encoding this data, but can't seem to find it in the library.

Any help would be greatly appreciated.

Note: I know it sounds crazy that I am trying to read in and parse session data directly but I assure you it's for a good reason.
Reply

#4
Check my answer here

https://stackoverflow.com/a/51103875/1214244
Reply

#5
CodeIgniter session doesn't call any form of serialize or unserialize directly, but, as pointed out by mwhitney, rely on PHP's session.serialize_handler instead. Perhaps you are running up against different php.ini configs and/or PHP versions.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.