Make WordPress Core

Changeset 34630


Ignore:
Timestamp:
09/27/2015 06:12:20 PM (9 years ago)
Author:
wonderboymusic
Message:

Nav Menus: in wp_nav_menu(), $container is already bound to a list of allowed tags. PHP, being its whimsical self, while return true if someone sets $container to true via in_array( true, [ 'div', 'nav' ] ). Check that $container is a string before the in_array() check. 'true' does not pass.

Props shedonist for the original patch.
Fixes #32464.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/nav-menu-template.php

    r34566 r34630  
    335335         */
    336336        $allowed_tags = apply_filters( 'wp_nav_menu_container_allowedtags', array( 'div', 'nav' ) );
    337         if ( in_array( $args->container, $allowed_tags ) ) {
     337        if ( is_string( $args->container ) && in_array( $args->container, $allowed_tags ) ) {
    338338            $show_container = true;
    339339            $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"';
Note: See TracChangeset for help on using the changeset viewer.