Make WordPress Core

Opened 7 years ago

Closed 4 years ago

#42274 closed defect (bug) (wontfix)

preview_sidebars_widgets unsetting $sidebars_widgets['array_version'] without check

Reported by: darrencoutts's profile darrencoutts Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Customize Keywords: reporter-feedback
Focuses: Cc:

Description (last modified by westonruter)

WP_Customize_Widgets::preview_sidebars_widgets() unsets $sidebars_widgets['array_version'] without checking that it is ever set in the first place.

Granted that it should be, however if a developer wants to remove all widgets from their site, it is possible that they will clear them from a database, a database may be corrupted, or a plugin/theme sets this option by mistake.

Suggest that this should have a conditional check to ensure that $sidebars_widgetsarray_version? is actually set and also ensure that this function always returns an array, even if the database has been emptied.

Change History (3)

#1 @westonruter
7 years ago

  • Description modified (diff)
  • Keywords reporter-feedback added

@darrencoutts thanks for the report. Is this related to #27965?

Would you also clarify what you mean by emptying the database? Steps to reproduce the problem would be helpful.

#2 @westonruter
7 years ago

  • Version changed from trunk to 3.9

#3 @dlh
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Closing for lack of feedback. Additionally, unset() is safe to use even when the array key does not exist.

As for ensuring the method returns an array: The method already does due diligence by passing array() as the fallback to get_option(). Any additional database corruption would affect more than the Customizer, I think.

Note: See TracTickets for help on using tickets.