From 06c51c00429e3196351017c1ac42e4e50207673a Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Thu, 8 Sep 2016 07:06:30 +0000 Subject: [PATCH] Menus: Fix notices thrown by classes extending `Walker_Nav_Menu`. Methods in `Walker_Nav_Menu` can be called with multiple, incompatible `$args` objects so an `insset()` check is required to avoid throwing notices. Introduced in [38523]. Fixes #35206. Built from https://develop.svn.wordpress.org/trunk@38575 git-svn-id: http://core.svn.wordpress.org/trunk@38518 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-walker-nav-menu.php | 32 +++++++++++++-------------- wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/wp-includes/class-walker-nav-menu.php b/wp-includes/class-walker-nav-menu.php index 13c9e6dd0a..4c1a1f2c91 100644 --- a/wp-includes/class-walker-nav-menu.php +++ b/wp-includes/class-walker-nav-menu.php @@ -50,12 +50,12 @@ class Walker_Nav_Menu extends Walker { * @param stdClass $args An object of wp_nav_menu() arguments. */ public function start_lvl( &$output, $depth = 0, $args = array() ) { - if ( 'preserve' === $args->item_spacing ) { - $t = "\t"; - $n = "\n"; - } else { + if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; + } else { + $t = "\t"; + $n = "\n"; } $indent = str_repeat( $t, $depth ); $output .= "{$n}{$indent}{$n}"; @@ -99,12 +99,12 @@ class Walker_Nav_Menu extends Walker { * @param int $id Current item ID. */ public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { - if ( 'preserve' === $args->item_spacing ) { - $t = "\t"; - $n = "\n"; - } else { + if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; + } else { + $t = "\t"; + $n = "\n"; } $indent = ( $depth ) ? str_repeat( $t, $depth ) : ''; @@ -237,12 +237,12 @@ class Walker_Nav_Menu extends Walker { * @param stdClass $args An object of wp_nav_menu() arguments. */ public function end_el( &$output, $item, $depth = 0, $args = array() ) { - if ( 'preserve' === $args->item_spacing ) { - $t = "\t"; - $n = "\n"; - } else { + if ( isset( $args->item_spacing ) && 'discard' === $args->item_spacing ) { $t = ''; $n = ''; + } else { + $t = "\t"; + $n = "\n"; } $output .= "{$n}"; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 15549666d6..638528d011 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38574'; +$wp_version = '4.7-alpha-38575'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.