Ticket #26876: 26876.3.patch
File 26876.3.patch, 1.7 KB (added by , 9 years ago) |
---|
-
src/wp-includes/widgets.php
536 536 537 537 $settings = get_option( $this->option_name ); 538 538 539 if ( false === $settings && isset( $this->alt_option_name ) ) { 540 $settings = get_option( $this->alt_option_name ); 539 if ( false === $settings ) { 540 if ( isset( $this->alt_option_name ) ) { 541 $settings = get_option( $this->alt_option_name ); 542 } else { 543 // Save an option so it can be autoloaded next time. 544 $this->save_settings( array() ); 545 } 541 546 } 542 547 543 548 if ( ! is_array( $settings ) && ! ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) ) { -
tests/phpunit/tests/widgets.php
233 233 $this->assertArrayHasKey( 'title', $instance ); 234 234 unset( $option_value['_multiwidget'] ); 235 235 236 // Pretend this widget is new. 237 delete_option( 'widget_nav_menu' ); 238 $never_used = get_option( 'widget_nav_menu' ); 239 $this->assertFalse( $never_used ); 240 236 241 wp_widgets_init(); 237 242 $wp_widget_search = $wp_registered_widgets['search-2']['callback'][0]; 238 243 … … 243 248 foreach ( $option_value as $widget_number => $instance ) { 244 249 $this->assertEquals( $settings[ $widget_number ], $option_value[ $widget_number ] ); 245 250 } 251 252 // After widgets_init(), get_settings() should create the widget option. 253 $never_used = get_option( 'widget_nav_menu' ); 254 $this->assertEquals( 1, $never_used['_multiwidget'] ); 255 $this->assertArrayNotHasKey( 0, $never_used ); 246 256 } 247 257 248 258 /**