title: Php Serialization Format
body: <p>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:</p>
  
  <pre><code>$_SESSION["userid"] = 42;
  echo session_encode();
  </code></pre>
  
  <p>prints out</p>
  
  <pre><code>userid|i:42;
  </code></pre>
  
  <p>whereas phpserialize serializes this as:</p>
  
  <pre><code>phpserialize.serialize({'userid':42})
  'a:1:{s:6:"userid";i:42;}'
  </code></pre>
  
  <p>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?</p>