Has anybody had this problem? Here's what's going on:
I serialize a large object and save it to the file system using this code:
Then I read it back from the disk using this code:
This barfed whenever the serialized string contained a newline, because evidentally the newline was saved as "\n\r", and that carriage return was screwing up the unserialization. (I'm running Apache/PHP locally on my Windows XP) Here's the modified code that avoids this problem:
Anybody have any comments on this?
petey
I serialize a large object and save it to the file system using this code:
Code:
if ($fp = fopen($objfile, 'w'))
fputs($fp, serialize($obj)); fclose($fp);
Code:
$obj = unserialize(implode("", @file($objfile)));
Code:
$obj = unserialize(str_replace("\r",'',implode("", @file($objfile))));
petey