[wp-trac] [WordPress Trac] #39811: Bug maybe_unserialize() broke mysql data.
WordPress Trac
noreply at wordpress.org
Wed Feb 8 13:53:07 UTC 2017
#39811: Bug maybe_unserialize() broke mysql data.
--------------------------------------+-----------------------------
Reporter: ivijanstefan | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.7.2
Severity: normal | Keywords:
Focuses: administration, template |
--------------------------------------+-----------------------------
I have an issue what is realated to maybe_unserialize() function.
Example:
When someone made MySQL export or backup and you want that data to import
in database again, widgets, some plugin setup, some template setup,
particular WPBakery Visual Composer or similar visual editors lost it's
setup.
To get all work well I change function into this:
{{{
function maybe_unserialize( $original ) {
if ( is_serialized( $original ) ) {
$fixed = preg_replace_callback(
'!(?<=^|;)s:(\d+)(?=:"(.*?)";(?:}|a:|s:|b:|i:|o:|N;))!s',
'serialize_fix_callback',
$original );
return @unserialize( $fixed );
}
return $original;
}
function serialize_fix_callback($match) { return 's:' . strlen($match[2]);
}
}}}
-wit this code I get all data to work well but I'm unable to install new
plugins or made any kind of update.
What to do with it, how to fix this problem and can you made some update
to this code or add some solution to not happen this problems?
Here is also my StackOwerflow question:
http://wordpress.stackexchange.com/q/255591/82023
Thanks!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39811>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list