Created
December 14, 2015 12:50
-
-
Save replsv/d0d3cd727e4ad18147ff to your computer and use it in GitHub Desktop.
fix manually modified serialized string
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
<?php | |
$initialData = file_get_contents("./old.ser"); | |
$data = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $initialData); | |
$fp = fopen ("./new.ser", "w"); | |
fwrite($fp, $data); | |
fclose($fp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment