Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function maybe_unserialize( $original ) {
- if ( is_serialized( $original ) ){ // don't attempt to unserialize data that wasn't serialized going in
- $fixed = preg_replace_callback(
- '!(?<=^|;)s:(\d+)(?=:"(.*?)";(?:}|a:|s:|b:|i:|o:|N;))!s',
- 'serialize_fix_callback',
- $original );
- // HACK HACK
- if ($original != $fixed) {
- $myfile = "/home/user/www/was.log";
- $fh = fopen($myfile, 'a');
- fwrite($fh, "Not legal serializable data. Was\n\t$original\nbut should be\n\t$fixed");
- fclose($fh);
- }
- return @unserialize( $original );
- }
- return $original;
- }
Add Comment
Please, Sign In to add comment