I'm trying to use the Python phpserialize library to read serialized session data from PHP. However, I discovered that my PHP setup is saving session data in a format that is different from what phpserialize (and pretty much all other documentation across the web) expects. For example:
$_SESSION["userid"] = 42;
echo session_encode();
prints out
userid|i:42;
whereas phpserialize serializes this as:
phpserialize.serialize({'userid':42})
'a:1:{s:6:"userid";i:42;}'
I checked the session.serialize_handler through phpinfo() and it's set to 'php' (the other options being php_binary and wddx). I cannot use any of the standard php serialization libraries in python as a result. Any suggestions?
session_encode- Please note the serialization method is not the same asserialize(). The serialization method is internal to PHP can can be set usingsession.serialize_handler.serializeis the PHP serialization format that phpserialize emulates. The above is saying that session data is saved in another format that is not the same as the PHP serialization format.