Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#24014 closed defect (bug) (fixed)

Undefined variable: nav_menu_id in /wp-includes/nav-menu.php on line 195

Reported by: chipbennett's profile chipbennett Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.6 Priority: normal
Severity: minor Version: 3.6
Component: Menus Keywords: has-patch
Focuses: Cc:

Description

To reproduce:

  1. Delete an existing nav menu

Error (PHP notice):

Notice: Undefined variable: nav_menu_id in /xxxxxx/wp-includes/nav-menu.php on line 195

Core code:

      // Remove this menu from any locations.
193	        $locations = get_theme_mod( 'nav_menu_locations' );
194	        foreach ( (array) $locations as $location => $menu_id ) {
195	                if ( $menu_id == $nav_menu_id )
196	                        $locations[ $location ] = 0;
197	        }
198	        set_theme_mod( 'nav_menu_locations', $locations );

Offending line:

if ( $menu_id == $nav_menu_id )

...but $nav_menu_id is not defined in the function.

Attachments (2)

24014.patch (533 bytes) - added by SergeyBiryukov 11 years ago.
24014.2.patch (528 bytes) - added by c3mdigital 11 years ago.

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.6

Introduced in [23897].

#2 follow-up: @SergeyBiryukov
11 years ago

  • Keywords has-patch added

@c3mdigital
11 years ago

#3 in reply to: ↑ 2 @c3mdigital
11 years ago

Replying to SergeyBiryukov:

Should have refreshed the page. Didn't see your patch.

#4 @SergeyBiryukov
11 years ago

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

In 23941:

Use correct variable. fixes #24014. see #23119.

Note: See TracTickets for help on using tickets.