Opened 10 years ago
Closed 10 years ago
#27965 closed defect (bug) (worksforme)
Error in theme customizer if all widget areas are empty
Reported by: | jramon.redondo | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9 |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description
If all widget areas in a theme are empty (without any widget) then theme customizer fails with error:
PHP Warning: array_merge(): Argument #3 is not an array in class-wp-customize-widgets.php on line 403
PHP Warning: Invalid argument supplied for foreach() in class-wp-customize-widgets.php on line 436
PHP Fatal error: Cannot unset string offsets in class-wp-customize-widgets.php on line 990
If there is a widget in some area, all runs fine.
Change History (6)
#3
@
10 years ago
Needle, thanks a lot, your fix works like a charm. I am going to reproduce your fix here to help other people:
add_filter('sidebars_widgets', 'fix_error_in_theme_customizer_wp39', 999); function fix_error_in_theme_customizer_wp39( $array ) { if ( !is_array( $array ) ) { $array = array(); } return $array; }
Note: See
TracTickets for help on using
tickets.
Hi jramon.redondo, an interim fix can be found here: ticket:14876#comment:8 though it looks like the devs are not yet persuaded that sanity checking the return value is necessary. Hopefully your report will help tip the balance.