UnexpectedValueException in session_start() php failing SPLObjectStorage serialization -


why unexpectedvalueexception thrown in session_start()?

i have object has property of splobjectstorage. object assigned session like

$_session['foo'] = $barobject; 

i suspect internal session serializing facing problem decode it. store session in database , looks serializing objectstorage can not decode it.

sample session data

self|o:4:"user":8:{s:5:"�*�id";n;s:7:"�*�nick";n;s:13:"�*�reputation";i:1;s:11:"�*�password";n;s:8:"�*�email";n;s:7:"�*�crud";o:10:"crudobject":2:{s:13:"�*�fieldcache";a:0:{}s:13:"�*�dependency";r:1;}s:7:"�*�auth";n;s:11:"�*�rolelist";c:11:"rolestorage":23:{x:i:1;n;,r:13;;m:a:0:{}}} 

rolestorage extends of splobjectstorage session_decode() on above string returns false ideas?

removing rolelist attribute makes serialize properly.

if separately do

$sr = serialize($roles); // $roles rolestorage object var_dump($sr); var_dump(unserialize($sr)); 

it prints string 'c:11:"rolestorage":22:{x:i:1;n;,r:3;;m:a:0:{}}' (length=46) , fails same message while unserializing. have no clue why happening.

note: while attaching object rolestorage used object data. means stored reference. don't know how (if) serialize() handles internally this.

i have no clue why happening

in php version , your concrete script not possible serialize object based on splobjectstorage unless take care of serialization own. if see part of serialized string:

c:11:"rolestorage":23:{x:i:1;n;,r:13;;m:a:0:{}} 

this represents rolestorage object. big c @ beginning stands for:

c - object implementing serializeable interface

so object responsible here serialization , unserialization. can expect works, not software without bugs.

in case looks php made mistake. internal format here is:

x:i:1;n;,r:13;;m:a:0:{}        ^^^^^^^ 

and problem @ highlighted position, requires serialized object, not null. , it's not comma-terminated reference (r:13 here), null (n) working.

so looks hick-up triggered referencing earlier object (take care referencing not same references / variable aliases in userland php).

so how go on?

it's time start isolate problem , create self-contained, reproduceable example out of it. necessary further issue see it. important 2 reasons:

  1. if bug in php, should reported, regression test written , added php q&a , bug fixed (if not yet fixed).
  2. if you're looking workaround, reproducing original problem necessary create workaround , easily.

i did run tests work-around, far i'm not able reproduce issue can not suggest how work around issue don't have here.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -