Make WordPress Core

Changeset 40092


Ignore:
Timestamp:
02/21/2017 03:50:13 AM (10 years ago)
Author:
dd32
Message:

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.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/class-walker-page.php

    r39051 r40092  
    5454         */
    5555        public function start_lvl( &$output, $depth = 0, $args = array() ) {
    56                 if ( 'preserve' === $args['item_spacing'] ) {
     56                if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
    5757                        $t = "\t";
    5858                        $n = "\n";
    … …  
    7979         */
    8080        public function end_lvl( &$output, $depth = 0, $args = array() ) {
    81                 if ( 'preserve' === $args['item_spacing'] ) {
     81                if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
    8282                        $t = "\t";
    8383                        $n = "\n";
    … …  
    104104         */
    105105        public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
    106                 if ( 'preserve' === $args['item_spacing'] ) {
     106                if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
    107107                        $t = "\t";
    108108                        $n = "\n";
    … …  
    197197         */
    198198        public function end_el( &$output, $page, $depth = 0, $args = array() ) {
    199                 if ( 'preserve' === $args['item_spacing'] ) {
     199                if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
    200200                        $t = "\t";
    201201                        $n = "\n";
Note: See TracChangeset for help on using the changeset viewer.