Widgets: Don't try mapping empty sidebars.

Fixes a bug where the mapping logic would try mapping empty sidebars, resulting in PHP warnings.

Props ionvv, chetan200891 for initial patch.
Fixes #42603.



git-svn-id: https://develop.svn.wordpress.org/trunk@42362 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland
2017-12-04 20:11:11 +00:00
parent 59612bff8b
commit 6cb2a02695
2 changed files with 5 additions and 1 deletions

View File

@@ -729,7 +729,7 @@ class Tests_Widgets extends WP_UnitTestCase {
global $sidebars_widgets, $_wp_sidebars_widgets;
wp_widgets_init();
$this->register_sidebars( array( 'sidebar-1', 'sidebar-2', 'sidebar-3', 'wp_inactive_widgets' ) );
$this->register_sidebars( array( 'sidebar-1', 'sidebar-2', 'sidebar-3', 'sidebar-4', 'wp_inactive_widgets' ) );
// Test restoring sidebars widgets when previously activated.
set_theme_mod(
@@ -739,6 +739,7 @@ class Tests_Widgets extends WP_UnitTestCase {
'sidebar-1' => array( 'tag_cloud-1' ),
'sidebar-2' => array(),
'sidebar-3' => array( 'unregistered_widget-1', 'text-1', 'media_image-1' ),
'sidebar-4' => null, // Should be converted to array.
'orphaned_widgets_1' => array( 'media_video-2' ),
),
)