Skip to content

Instantly share code, notes, and snippets.

@tranchausky
Created August 1, 2020 08:40
Show Gist options
  • Select an option

  • Save tranchausky/ffe1d603af69bd6453cf2970acd32d0c to your computer and use it in GitHub Desktop.

Select an option

Save tranchausky/ffe1d603af69bd6453cf2970acd32d0c to your computer and use it in GitHub Desktop.
fix unserialize in php, fix PHP: error: Notice: unserialize(): Error at offset 438 of 750 bytes in
<?php
$str = preg_replace_callback(
'!s:(\d+):"(.*?)";!',
function($m) {
return 's:'.strlen($m[2]).':"'.$m[2].'";';
},
$str);
var_dump(unserialize($str));
//https://stackoverflow.com/a/48250181
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment