Session library and unserialize() error. |
[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 ?
[eluser]Twisted1919[/eluser]
The suspense is killing me, does anyone has an answer ? (Maybe the developers ?)
[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.
[eluser]MVUG[/eluser]
what CI version do you use? And what are you trying to unserialize, normal data or?
[eluser]Twisted1919[/eluser]
Hi, I am using the 2.0 Reactor Version . I am setting the session data like this: Code: $session_data=array(
[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.
[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.
[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/codeignit...bb586e29d9
[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... |
Welcome Guest, Not a member yet? Register Sign In |