thiggins09 Posted August 14, 2007 Share Posted August 14, 2007 Hi, I have since fixed my last problem with the communities help but now have a new one. I have a serialized array which has somehow become corrupt. Is there anything that can attempt to correct it? Quote Link to comment https://forums.phpfreaks.com/topic/64932-damaged-serialized-array/ Share on other sites More sharing options...
hostfreak Posted August 14, 2007 Share Posted August 14, 2007 Can you post the code in which you serialize and unserialize it? edit- you don't have access to the original value before it was serialized? Quote Link to comment https://forums.phpfreaks.com/topic/64932-damaged-serialized-array/#findComment-324026 Share on other sites More sharing options...
thiggins09 Posted August 14, 2007 Author Share Posted August 14, 2007 No sorry I don't. It's only stored as a serialized array. Here is how I open and serialize / unserialize the array. $xFile='x/list.php'; if($xPath=fopen($xFile,'r')) { $xContent=unserialize(fread($xPath,filesize($xFile))); fclose($xPath); } and serializing / writing. if($xPath=fopen($xFile,'w')) { fwrite($xPath,serialize($xContent)); fclose($xPath); } Quote Link to comment https://forums.phpfreaks.com/topic/64932-damaged-serialized-array/#findComment-324037 Share on other sites More sharing options...
thiggins09 Posted August 14, 2007 Author Share Posted August 14, 2007 I see now that I should have another if for unserializing and serializing... but what should I do about my corrupt serialized array? Quote Link to comment https://forums.phpfreaks.com/topic/64932-damaged-serialized-array/#findComment-324057 Share on other sites More sharing options...
thiggins09 Posted August 15, 2007 Author Share Posted August 15, 2007 Anyone know a way to save the data? I would manually rewrite it but its about 400 multidimensional keys. Quote Link to comment https://forums.phpfreaks.com/topic/64932-damaged-serialized-array/#findComment-324303 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.