The solution looks worked perfect for my script. I wonder you have put your thoughts rights to publish it over here
thanks
Notice: unserialize() [function.unserialize]: Error at offset (fix)
Collapse
X
-
Notice: unserialize() [function.unserialize]: Error at offset (fix)
here is a fix for those who get error like:
Notice: unserialize() [function.unserialize]: Error at offset
while trying to unserialize a serialized string.
fix number 1 (use this function instead of unserialize):
PHP Code:function mb_unserialize($serial_str) {
$out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str );
return unserialize($out);
}
PHP Code://to safely serialize
$safe_string_to_store = base64_encode(serialize($multidimensional_array));
//to unserialize...
$array_restored_from_db = unserialize(base64_decode($encoded_serialized_string));
Tags: None
Leave a comment: