Menus: Prevent notice thrown in class-walker-page.php.

Calling `Walker_Page::walk()` directly was causing an `Undefined index: item_spacing` notice to be thrown, this adds an `isset()` check to prevent it.

Props bhargavbhandari90, peterwilsoncc.
Merges [39949] to the 4.7 branch.
Fixes #39564.

Built from https://develop.svn.wordpress.org/branches/4.7@40092


git-svn-id: http://core.svn.wordpress.org/branches/4.7@40029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2017-02-21 03:51:35 +00:00
parent e18e5acce8
commit d1b2273838
2 changed files with 5 additions and 5 deletions

View File

@ -53,7 +53,7 @@ class Walker_Page extends Walker {
* Default empty array. * Default empty array.
*/ */
public function start_lvl( &$output, $depth = 0, $args = array() ) { public function start_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'preserve' === $args['item_spacing'] ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
$t = "\t"; $t = "\t";
$n = "\n"; $n = "\n";
} else { } else {
@ -78,7 +78,7 @@ class Walker_Page extends Walker {
* Default empty array. * Default empty array.
*/ */
public function end_lvl( &$output, $depth = 0, $args = array() ) { public function end_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'preserve' === $args['item_spacing'] ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
$t = "\t"; $t = "\t";
$n = "\n"; $n = "\n";
} else { } else {
@ -103,7 +103,7 @@ class Walker_Page extends Walker {
* @param int $current_page Optional. Page ID. Default 0. * @param int $current_page Optional. Page ID. Default 0.
*/ */
public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) { public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
if ( 'preserve' === $args['item_spacing'] ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
$t = "\t"; $t = "\t";
$n = "\n"; $n = "\n";
} else { } else {
@ -196,7 +196,7 @@ class Walker_Page extends Walker {
* @param array $args Optional. Array of arguments. Default empty array. * @param array $args Optional. Array of arguments. Default empty array.
*/ */
public function end_el( &$output, $page, $depth = 0, $args = array() ) { public function end_el( &$output, $page, $depth = 0, $args = array() ) {
if ( 'preserve' === $args['item_spacing'] ) { if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
$t = "\t"; $t = "\t";
$n = "\n"; $n = "\n";
} else { } else {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7.3-alpha-40091'; $wp_version = '4.7.3-alpha-40092';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.