PHP unserialize returns empty array
Posted on 2007-03-30
I use serialize() to store an (maximum of three levels deep) array into a database field, which until now worked very fine. The data that is being stored, is mainly coming from a richt-text editor. The whole thing is used in a tool i have created for a client, which worked just very fine for almost a year now. However, just today my client has stored some information that for some reason can not be unserialized. PHP unserialize() just returns me nothing. An empty array, that is.
I now need to restore the information, so that it can be unserialized again, but still after hours of trying, i do not seem to find the error, nor do i seem to see any reason for the problem to occur.
My actual question is: how can i restore the information most efficiently? Is there any function that can analyze the broken data? Or an alternative to unserialize() that will not just return false but at least tell me where the problem resides, where it stops parsing?
I am looking forward to suggestions. Thank you very much.
Ps.: I do know about quoting problems and i can say for sure that it is none of those. In fact my client uses single and double quotes in his data frequently, but it has never been a problem. I made the script solid in that relation.