[wp-trac] [WordPress Trac] #14876: wp_get_sidebars_widgets() assumes that widgets are enabled

WordPress Trac noreply at wordpress.org
Fri Apr 18 09:59:21 UTC 2014


#14876: wp_get_sidebars_widgets() assumes that widgets are enabled
--------------------------+-----------------------------
 Reporter:  nacin         |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  lowest        |   Milestone:  Future Release
Component:  Widgets       |     Version:
 Severity:  minor         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------------

Comment (by needle):

 Replying to [comment:9 westonruter]:
 > Replying to [comment:8 needle]:
 > > I have encountered a fatal error in
 `WP_Customize_Widgets->customize_register()` when opening the Theme
 Customizer. This was after switching to a theme that has only one (empty)
 widget area. I confirmed that `$sidebars_widgets` in
 `wp_get_sidebars_widgets()` is not set, which throws the error when
 customize_register() tries to include the result in an `array_merge()`.
 >
 > Strange, because `wp_get_sidebars_widgets()` is supplying `array()` as
 the default fallback value if the `sidebars_widgets` option has not been
 added:
 >
 > {{{
 > $sidebars_widgets = get_option('sidebars_widgets', array());
 > }}}
 >
 > So it shouldn't be returning anything other than an array. What does
 `$sidebars_widgets` get set to in your environment?

 It seems that the `sidebars_widgets` option itself has been set to `null`.
 This means that the fallback value is not used and therefore
 `$sidebars_widgets` is also set to `null`. I realise that this means
 digging into why the `sidebars_widgets` option has a `null` value, but
 that's why I suggested this might be an edge case.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/14876#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list