This file contains hidden or 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 | |
| /* | |
| * The `fix_serialized` function fixes serialized data which has been corrupted by an incorrect byte count length, | |
| * especially in the case of a search & replace done on a dump of a wordpress database. | |
| */ | |
| $corruptedSerialization = 'a:3:{i:0;s:150:".DS_Store";i:1;s:100:".git";i:2;s:190:"node_modules";}'; | |
| if (is_serialized($corruptedSerialization)) { | |
| $fixed = fix_serialized($corruptedSerialization); | |
| print_r(unserialize($fixed)); | |
| } |