General: Move `maybe_serialize()` to a more appropriate place in the file, before `maybe_unserialize()`.
Rename the `$original` parameter of `maybe_unserialize()` to `$data`, for consistency with other serialization functions. See #36416. Built from https://develop.svn.wordpress.org/trunk@47453 git-svn-id: http://core.svn.wordpress.org/trunk@47240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
045d4face1
commit
0dc46c0ba5
|
@ -582,18 +582,44 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Unserialize value only if it was serialized.
|
||||
* Serialize data, if needed.
|
||||
*
|
||||
* @since 2.0.5
|
||||
*
|
||||
* @param string|array|object $data Data that might be serialized.
|
||||
* @return mixed A scalar data.
|
||||
*/
|
||||
function maybe_serialize( $data ) {
|
||||
if ( is_array( $data ) || is_object( $data ) ) {
|
||||
return serialize( $data );
|
||||
}
|
||||
|
||||
/*
|
||||
* Double serialization is required for backward compatibility.
|
||||
* See https://core.trac.wordpress.org/ticket/12930
|
||||
* Also the world will end. See WP 3.6.1.
|
||||
*/
|
||||
if ( is_serialized( $data, false ) ) {
|
||||
return serialize( $data );
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize data only if it was serialized.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
* @param string $original Maybe unserialized original, if is needed.
|
||||
* @param string $data Data that might be unserialized.
|
||||
* @return mixed Unserialized data can be any type.
|
||||
*/
|
||||
function maybe_unserialize( $original ) {
|
||||
if ( is_serialized( $original ) ) { // Don't attempt to unserialize data that wasn't serialized going in.
|
||||
return @unserialize( $original );
|
||||
function maybe_unserialize( $data ) {
|
||||
if ( is_serialized( $data ) ) { // Don't attempt to unserialize data that wasn't serialized going in.
|
||||
return @unserialize( $data );
|
||||
}
|
||||
return $original;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -695,31 +721,6 @@ function is_serialized_string( $data ) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize data, if needed.
|
||||
*
|
||||
* @since 2.0.5
|
||||
*
|
||||
* @param string|array|object $data Data that might be serialized.
|
||||
* @return mixed A scalar data
|
||||
*/
|
||||
function maybe_serialize( $data ) {
|
||||
if ( is_array( $data ) || is_object( $data ) ) {
|
||||
return serialize( $data );
|
||||
}
|
||||
|
||||
/*
|
||||
* Double serialization is required for backward compatibility.
|
||||
* See https://core.trac.wordpress.org/ticket/12930
|
||||
* Also the world will end. See WP 3.6.1.
|
||||
*/
|
||||
if ( is_serialized( $data, false ) ) {
|
||||
return serialize( $data );
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve post title from XMLRPC XML.
|
||||
*
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-47452';
|
||||
$wp_version = '5.5-alpha-47453';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue