I write chat on socket.io + Symfony2. My Symfony is configured to store session in mysql database. In socket.io server application I get this session from mysql, but very big problem is parse this session.
session_data field contain this string (after base64_decoded):
_sf2_attributes|a:1:{s:22:"_security_primary_auth";s:715:"C:74:"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":627:{a:3:{i:0;N;i:1;s:4:"main";i:2;s:587:"a:4:{i:0;C:30:"App\UserBundle\Entity\User":245:{a:9:{i:0;s:88:"mmTTBVj/wlB0EFvL1nkMmcW/DXd9jREQWAEWd5WJFNVnX2bJrpOTL3wZDO1+T5tYQsiXT8nyMYKbVSEZDq+QDQ==";i:1;s:31:"9mpqmv3075kw8k80wgoc8wokcgkw8sc";i:2;s:16:"[email protected]";i:3;s:16:"[email protected]";i:4;b:0;i:5;b:0;i:6;b:0;i:7;b:1;i:8;i:2;}}i:1;b:1;i:2;a:2:{i:0;O:41:"Symfony\Component\Security\Core\Role\Role":1:{s:47:"^@Symfony\Component\Security\Core\Role\Role^@role";s:12:"ROLE_COMPANY";}i:1;O:41:"Symfony\Component\Security\Core\Role\Role":1:{s:47:"^@Symfony\Component\Security\Core\Role\Role^@role";s:9:"ROLE_USER";}}i:3;a:0:{}}";}}";}_sf2_flashes|a:0:{}_sf2_meta|a:3:{s:1:"u";i:1383052184;s:1:"c";i:1383052144;s:1:"l";s:6:"360000";}
I use the js-php-unserialize - unserializeSession() to userialize and obtain another serialized data ("_sf2_attributes" key)
a:1:{s:22:"_security_primary_auth";s:715:"C:74:"Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken":627:{a:3:{i:0;N;i:1;s:4:"main";i:2;s:587:"a:4:{i:0;C:30:"App\UserBundle\Entity\User":245:{a:9:{i:0;s:88:"mmTTBVj/wlB0EFvL1DnMmcW/fgd9jREQWAEWd5WJFNVnX2bJrpOTL3wZDO1+T5tYQsiXT8nyMYKbVSEZDq+QDQ==";i:1;s:31:"9mpqmv3075kw8k804soc8fgkcgkw8sc";i:2;s:16:"[email protected]";i:3;s:16:"[email protected]";i:4;b:0;i:5;b:0;i:6;b:0;i:7;b:1;i:8;i:2;}}i:1;b:1;i:2;a:2:{i:0;O:41:"Symfony\Component\Security\Core\Role\Role":1:{s:47:"^@Symfony\Component\Security\Core\Role\Role^@role";s:12:"ROLE_COMPANY";}i:1;O:41:"Symfony\Component\Security\Core\Role\Role":1:{s:47:"^@Symfony\Component\Security\Core\Role\Role^@role";s:9:"ROLE_USER";}}i:3;a:0:{}}";}}";}
and there is my problem - I can't unserialize, I try more libs. I think problem is in the "C:" key, how transform this serialized string in javascript object?