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

Props pbearne, mikeschroder.
Fixes #36416.

git-svn-id: https://develop.svn.wordpress.org/trunk@47454 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-03-13 21:12:01 +00:00
parent 13c5098f74
commit 31dd2e70f0
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -616,7 +616,7 @@ function maybe_serialize( $data ) {
*/
function maybe_unserialize( $data ) {
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;