Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#23508 closed defect (bug) (fixed)

Nav Menu Saving: get_nav_menu_locations() can return false, code expects array

Reported by: Viper007Bond Owned by: SergeyBiryukov
Priority: normal Milestone: 3.6
Component: Menus Version: 3.6
Severity: normal Keywords: has-patch 3.6-menus needs-codex
Cc: Focuses:

Description

get_nav_menu_locations() can return false (it is right now with Twenty Thirteen) but /wp-admin/nav-menu.php tries to always treat it as an array:

https://core.trac.wordpress.org/browser/trunk/wp-admin/nav-menus.php?rev=23441#L277

This throws a warning and breaks stuff.

Attachments (3)

23508.diff (447 bytes ) - added by JustinSainton 13 years ago.
23508.2.diff (988 bytes ) - added by SergeyBiryukov 13 years ago.
23508.3.diff (1013 bytes ) - added by SergeyBiryukov 13 years ago.

Download all attachments as: .zip

Change History (14)

#1 @SergeyBiryukov
13 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review3.6

#2 @SergeyBiryukov
13 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 23453:

Fix a warning on Menus screen if $menu_locations is false.
Fix menu selection after creating a first menu on new install.

props jkudish.
fixes #23508. see #23119.

#3 @nacin
13 years ago

  • Resolution fixed
  • Status closedreopened

I think get_nav_menu_locations() should always return an array, as the docs say. Let's try to also fix that?

#4 @SergeyBiryukov
13 years ago

  • Keywords needs-patch added

@JustinSainton
13 years ago

#5 @JustinSainton
13 years ago

Ensures that get_nav_menu_locations() always returns an array.

#6 @DrewAPicture
13 years ago

  • Keywords has-patch 3.6-menus added; needs-patch removed
  • Versiontrunk

#7 @jkudish
13 years ago

  • Cc jkudish added

#9 @SergeyBiryukov
13 years ago

Not sure if we need the ! empty() check, is_array() seems enough (23508.2.diff).

#10 @SergeyBiryukov
13 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 23550:

Ensure that get_nav_menu_locations() always returns an array. props JustinSainton for initial patch. fixes #23508.

#11 @DrewAPicture
13 years ago

  • Keywords needs-codex added
Note: See TracTickets for help on using tickets.