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:
parent
13c5098f74
commit
31dd2e70f0
@ -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;
|
||||
|
@ -291,6 +291,7 @@ class Tests_Functions extends WP_UnitTestCase {
|
||||
),
|
||||
true,
|
||||
),
|
||||
array( ' s:25:"this string is serialized"; ', true ),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user