I want to unserialize a session_encode()‘d string of session data to my own array (i.e. not to $_SESSION.)
There doesn’t appear to be an in-built function that handles this. There’s session_decode() but it writes directly to the $_SESSION super-global. There’s unserialize() but it returns false on session_encode()‘d strings as they’re a slightly different format.
What’s the best way to do this?
Advertisement
Answer
Check out the comments in the PHP manual’s session_decode page. It has a bunch of user functions to handle decoding a session_encode string manually. As far as I know, that’s the only way to go.