Make WordPress Core

Opened 9 years ago

Closed 9 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:

Description

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 9 years ago.

Download all attachments as: .zip

Change History (4)

@dlh
9 years ago

#1 @swissspidy
9 years ago

  • Keywords has-patch added

#2 @westonruter
9 years ago

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

#3 @SergeyBiryukov
9 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.