Session library and unserialize() error. - 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 library and unserialize() error. (/showthread.php?tid=38407) |
Session library and unserialize() error. - El Forum - 02-07-2011 [eluser]Twisted1919[/eluser] My logs shows: Code: ERROR - 2011-02-06 20:37:49 --> Severity: Notice --> unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 0 of 214 bytes /xxx/yyy/zzz/yyy/sys/libraries/Session.php 722 I am saving the session to database(CI Reactor), and the user_data field is MEDIUMTEXT so there is no way the issue is because of mysql truncating the record, so what it is ? Session library and unserialize() error. - El Forum - 02-08-2011 [eluser]Twisted1919[/eluser] The suspense is killing me, does anyone has an answer ? (Maybe the developers ?) Session library and unserialize() error. - El Forum - 02-08-2011 [eluser]guidorossi[/eluser] uhmm... wich PHP version are you using? EDIT: check this out http://davidwalsh.name/php-serialize-unserialize-issues Quote:It turns out that if there's a ", ', :, or ; in any of the array values the serialization gets corrupted. Session library and unserialize() error. - El Forum - 02-09-2011 [eluser]MVUG[/eluser] what CI version do you use? And what are you trying to unserialize, normal data or? Session library and unserialize() error. - El Forum - 02-09-2011 [eluser]Twisted1919[/eluser] Hi, I am using the 2.0 Reactor Version . I am setting the session data like this: Code: $session_data=array( Session library and unserialize() error. - El Forum - 02-09-2011 [eluser]MVUG[/eluser] weird... already tried to install new CI again? Session library and unserialize() error. - El Forum - 02-09-2011 [eluser]Twisted1919[/eluser] Nope, i did not because i don't do things like this. I know that all my libraries are up to date, so there is no use to make another install(and is not easy having in mind the complexity of the project). Though, i extended the Session library like: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); So now i am base64_encoding/decoding before before serialize/unserialize. I need to do more tests to see if i receive the error again, if not i'll fill a bug report on this. Session library and unserialize() error. - El Forum - 02-09-2011 [eluser]Twisted1919[/eluser] Neah, the above solution is not valid, the issue is still open. L.E: What is weird, is that if i copy the data from database and "unserialize" it, it gives no error whatsoever. Session library and unserialize() error. - El Forum - 02-10-2011 [eluser]MVUG[/eluser] [quote author="Twisted1919" date="1297281529"]Nope, i did not because i don't do things like this. I know that all my libraries are up to date, so there is no use to make another install(and is not easy having in mind the complexity of the project). Though, i extended the Session library like: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); So now i am base64_encoding/decoding before before serialize/unserialize. I need to do more tests to see if i receive the error again, if not i'll fill a bug report on this.[/quote] Why are you base64 encoding/decoding here? There was an issue with CI and the serialize/unserializing of objects... In CI 2.0 this is fixed, check this code out: https://bitbucket.org/ellislab/codeigniter-reactor/changeset/b3bb586e29d9 Session library and unserialize() error. - El Forum - 02-10-2011 [eluser]MVUG[/eluser] mmm is this right? Code: return base64_encode(serialize($data)); shouldn't it be Code: return serialize(base64_encode($data)); You must first base64_encode your data and THEN serialize it. For unserialize you should unserialize and then base64_decode... |