Ticket #42603: 42603.2.diff
File 42603.2.diff, 1.5 KB (added by , 7 years ago) |
---|
-
src/wp-includes/widgets.php
1294 1294 1295 1295 if ( is_array( $old_sidebars_widgets ) ) { 1296 1296 1297 // Remove empty sidebars, no need to map those. 1298 $old_sidebars_widgets = array_filter( $old_sidebars_widgets ); 1299 1297 1300 // Only check sidebars that are empty or have not been mapped to yet. 1298 1301 foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) { 1299 1302 if ( array_key_exists( $new_sidebar, $old_sidebars_widgets ) && ! empty( $new_widgets ) ) { -
tests/phpunit/tests/widgets.php
709 709 global $sidebars_widgets, $_wp_sidebars_widgets; 710 710 711 711 wp_widgets_init(); 712 $this->register_sidebars( array( 'sidebar-1', 'sidebar-2', 'sidebar-3', ' wp_inactive_widgets' ) );712 $this->register_sidebars( array( 'sidebar-1', 'sidebar-2', 'sidebar-3', 'sidebar-4', 'wp_inactive_widgets' ) ); 713 713 714 714 // Test restoring sidebars widgets when previously activated. 715 715 set_theme_mod( 'sidebars_widgets', array( … … 718 718 'sidebar-1' => array( 'tag_cloud-1' ), 719 719 'sidebar-2' => array(), 720 720 'sidebar-3' => array( 'unregistered_widget-1', 'text-1', 'media_image-1' ), 721 'sidebar-4' => null, // Should be converted to array. 721 722 'orphaned_widgets_1' => array( 'media_video-2' ), 722 723 ), 723 724 ) );