General: Trim the input data in `maybe_unserialize()`, for consistency with `is_serialized()`.

Props pbearne, mikeschroder.
Fixes #36416.
Built from https://develop.svn.wordpress.org/trunk@47454


git-svn-id: http://core.svn.wordpress.org/trunk@47241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-03-13 21:13:08 +00:00
parent 0dc46c0ba5
commit d5f942d7ba
2 changed files with 2 additions and 2 deletions

View File

@ -616,7 +616,7 @@ function maybe_serialize( $data ) {
*/ */
function maybe_unserialize( $data ) { function maybe_unserialize( $data ) {
if ( is_serialized( $data ) ) { // Don't attempt to unserialize data that wasn't serialized going in. if ( is_serialized( $data ) ) { // Don't attempt to unserialize data that wasn't serialized going in.
return @unserialize( $data ); return @unserialize( trim( $data ) );
} }
return $data; return $data;

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-alpha-47453'; $wp_version = '5.5-alpha-47454';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.