I thought that session data was converted to a string using serialize() but there seems to be some differences between the output of serialize() and the string that is in the session file.
<?
$foo = array('bar' => 'whoa');
$foo2 = array('ni'=>'geek');
print serialize($foo) . "\n" . serialize($foo2) . "\n";
$_SESSION['foo'] = $foo;
$_SESSION['um'] = $foo2;
print serialize($_SESSION) . "\n";
?>
a:1:{s:3:"bar";s:4:"whoa";}
a:1:{s:2:"ni";s:4:"geek";}
a:2:{s:3:"foo";a:1:{s:3:"bar";s:4:"whoa";}s:2:"um";a:1:{s:2:"ni";s:4:"geek";}}
While the file contains:
foo|a:1:{s:3:"bar";s:4:"whoa";}um|a:1:{s:2:"ni";s:4:"geek";}
Does anyone know why there is this discrepency? And how to get around it? PHP can't seem to unserialize() the string in the file, so I'm assuming something happens someplace else that turns it into a parseable string, but I'm not sure what. Thanks,
-Chris