Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#35928 closed defect (bug) (fixed)

Notice in `is_dynamic_sidebar()`

Reported by: dlh's profile dlh Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Widgets Keywords: has-patch commit
Focuses: Cc:


A sidebar can be registered but not yet have an index in the sidebars_widgets option.

is_dynamic_sidebar() checks count($sidebars_widgets[$index]) for each registered sidebar, potentially, but if it reaches a sidebar that doesn't have an index in the option, it generates an "undefined index" notice.

The attached patch adds an isset() check.

Attachments (1)

35928.patch (677 bytes) - added by dlh 8 years ago.

Download all attachments as: .zip

Change History (4)

8 years ago

#1 @swissspidy
8 years ago

  • Keywords has-patch added

#2 @westonruter
8 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 4.5

#3 @SergeyBiryukov
8 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 36667:

Widgets: Avoid a PHP notice in is_dynamic_sidebar() is a sidebar is registered but does not yet have an index in the sidebars_widgets option.

Props dlh.
Fixes #35928.

Note: See TracTickets for help on using tickets.