WordPress.org

Make WordPress Core

#24014 closed defect (bug) (fixed)

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

Reported by: chipbennett Owned by: 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 13 months ago.
24014.2.patch (528 bytes) - added by c3mdigital 13 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 SergeyBiryukov13 months ago

  • Milestone changed from Awaiting Review to 3.6

Introduced in [23897].

SergeyBiryukov13 months ago

comment:2 follow-up: SergeyBiryukov13 months ago

  • Keywords has-patch added

c3mdigital13 months ago

comment:3 in reply to: ↑ 2 c3mdigital13 months ago

Replying to SergeyBiryukov:

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

comment:4 SergeyBiryukov13 months 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.