Skip to content

Instantly share code, notes, and snippets.

@dmitriynet
Created November 20, 2015 10:05
Show Gist options
  • Save dmitriynet/911a1934af2a05274e5f to your computer and use it in GitHub Desktop.
Save dmitriynet/911a1934af2a05274e5f to your computer and use it in GitHub Desktop.
mb_unserialize
function mb_unserialize($string)
{
$recovered = preg_replace_callback(
'!(?<=^|;)s:(\d+)(?=:"(.*?)";(?:}|a:|s:|b:|d:|i:|o:|N;))!s',
function($match) {
return 's:' . mb_strlen($match[2], '8bit');
},
$string
);
return unserialize($recovered);
}
@marcaum54
Copy link

TY man.... save my night

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment