Widgets: Fix an “Invalid value” warning when adding a new widget in the Customizer.

This fixes a regression introduced in [50996] where sites that have been opted-out of the block-based widget editor experienced an “Invalid value.” error when adding a new widget to a sidebar in the Customizer.

This was caused by the early return value was changed to `null` from `$value` when set to an empty `array`, resulting in the widget being evaluated as invalid elsewhere.

Props jamesros161, caseymilne, naoki0h, ixkaito, zieladam, noisysocks, hellofromTonya.
Fixes #53479.
Built from https://develop.svn.wordpress.org/trunk@51232


git-svn-id: http://core.svn.wordpress.org/trunk@50841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2021-06-25 00:08:58 +00:00
parent 2f063a72f2
commit 767be550d7
2 changed files with 2 additions and 2 deletions

View File

@ -1413,7 +1413,7 @@ final class WP_Customize_Widgets {
global $wp_widget_factory; global $wp_widget_factory;
if ( array() === $value ) { if ( array() === $value ) {
return; return $value;
} }
if ( isset( $value['raw_instance'] ) && $id_base && wp_use_widgets_block_editor() ) { if ( isset( $value['raw_instance'] ) && $id_base && wp_use_widgets_block_editor() ) {

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8-beta3-51231'; $wp_version = '5.8-beta3-51232';
/** /**
* 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.