Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#29743 closed task (blessed) (fixed)

warning with join in nav-menu-template.php (L 98) when apply_filters nav_menu_css_class return null

Reported by: eadoking's profile eadoking Owned by: johnbillion's profile johnbillion
Milestone: 4.1 Priority: normal
Severity: normal Version: 4.1
Component: Menus Keywords: needs-patch revert
Focuses: Cc:

Description

there is a warning because apply_filters on nav_menu_css_class return null and a warning happens in join clause , file "nav-menu-template.php" line 98

Attachments (1)

29743.diff (1018 bytes) - added by briandichiara 10 years ago.
patch for nav-menu-template.php, resolves notices when non-array passed through filter

Download all attachments as: .zip

Change History (9)

@briandichiara
10 years ago

patch for nav-menu-template.php, resolves notices when non-array passed through filter

This ticket was mentioned in Slack in #core by briandichiara. View the logs.


10 years ago

#2 @markjaquith
10 years ago

  • Keywords has-patch added

#3 @markjaquith
10 years ago

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

In 30032:

Cast class names to an array to avoid a potential warning.

props briandichiara
fixes #29743

#4 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 4.1

#5 @SergeyBiryukov
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

there is a warning because apply_filters on nav_menu_css_class return null

I think this should be considered a developer error. If the goal is to remove the classes, __return_empty_array() should be used here instead of __return_null().

But if we're going to keep [30032], we should do the same for body_class, post_class, comment_class, and page_css_class filters as well.

Last edited 10 years ago by SergeyBiryukov (previous) (diff)

#6 @johnbillion
10 years ago

  • Keywords needs-patch added; has-patch removed
  • Owner changed from markjaquith to johnbillion
  • Status changed from reopened to assigned
  • Type changed from enhancement to task (blessed)

I would like to revert r30032. I agree with Sergey that this is a developer error and the warning is appropriate.

#7 @ocean90
10 years ago

  • Keywords revert added

#8 @johnbillion
10 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r30592.

Note: See TracTickets for help on using tickets.