Site Health: Ensure each alloptions value is serialized.

This adds additional hardening to the Autoload options Health Check to avoid potential bugs when extenders return unserialzed values from `wp_load_alloptions()`.

Follow-up to [58332].

Props mukesh27, joemcgill, westonruter.
Fixes #61276.

Built from https://develop.svn.wordpress.org/trunk@58338


git-svn-id: http://core.svn.wordpress.org/trunk@57794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2024-06-04 19:34:16 +00:00
parent 147dc0623c
commit 9200aad73c
2 changed files with 6 additions and 3 deletions

View File

@ -2598,8 +2598,11 @@ class WP_Site_Health {
$total_length = 0;
foreach ( $alloptions as $option_name => $option_value ) {
$total_length += strlen( $option_value );
foreach ( $alloptions as $option_value ) {
if ( is_array( $option_value ) || is_object( $option_value ) ) {
$option_value = maybe_serialize( $option_value );
}
$total_length += strlen( (string) $option_value );
}
return $total_length;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.6-beta1-58337';
$wp_version = '6.6-beta1-58338';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.