WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13484 closed defect (bug) (fixed)

Undefined Index when enabling Nav-Menus

Reported by: etiger13 Owned by:
Milestone: 3.0 Priority: normal
Severity: trivial Version: 3.0
Component: Menus Keywords:
Focuses: Cc:

Description

In functions.php of my template file I added:

add_theme_support('nav-menus');

On the admin -> appearance -> Menus page I get at the top of the page:

Notice: Undefined index: _wp_registered_nav_menus in /Users/eddie/Dropbox/Web/DevSites/blog/wp-includes/nav-menu.php  on line 101

Notice: Undefined index: _wp_registered_nav_menus in /Users/eddie/Dropbox/Web/DevSites/blog/wp-includes/nav-menu.php on line 101

Warning: Cannot modify header information - headers already sent by (output started at /Users/eddie/Dropbox/Web/DevSites/blog/wp-includes/nav-menu.php:101) in /Users/eddie/Dropbox/Web/DevSites/blog/wp-includes/functions.php on line 823

Warning: Cannot modify header information - headers already sent by (output started at /Users/eddie/Dropbox/Web/DevSites/blog/wp-includes/nav-menu.php:101) in /Users/eddie/Dropbox/Web/DevSites/blog/wp-includes/functions.php on line 824

On line 100 of /wp-includes/nav-menu.php a check should be made to see if the index exists. Function should be changed to the below:

function get_registered_nav_menus() {
	if ( isset($GLOBALS['_wp_registered_nav_menus']) )
		return $GLOBALS['_wp_registered_nav_menus'];
}

This is on PHP 5.3.1.

This is not a mission critical. It is a minor annoyance that occurs with PHP error reporting on and outputting to the screen

Change History (1)

comment:1 nacin4 years ago

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

(In [14788]) Notice sanity check. fixes #13484, props etiger13.

Note: See TracTickets for help on using tickets.