Skip to content

Instantly share code, notes, and snippets.

@dmitriynet

dmitriynet/php

Created Nov 20, 2015
Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@marcaum54 marcaum54 commented Aug 2, 2019

TY man.... save my night

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