Created
October 21, 2019 05:48
-
-
Save VSeryoga/1d3307d2ae843807addd0e8f68384889 to your computer and use it in GitHub Desktop.
Восстановление serialize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function serialize_corrector($serialized_string){ | |
// at first, check if "fixing" is really needed at all. After that, security checkup. | |
if ( @unserialize($serialized_string) !== true && preg_match('/^[aOs]:/', $serialized_string) ) { | |
$serialized_string = preg_replace_callback( '/s\:(\d+)\:\"(.*?)\";/s', function($matches){return 's:'.strlen($matches[2]).':"'.$matches[2].'";'; }, $serialized_string ); | |
} | |
return $serialized_string; | |
} | |
unserialize( serialize_corrector( $serialized_string ) ) ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment