WordPress.org

Make WordPress Core

Ticket #45361: 45361.6.diff

File 45361.6.diff, 1.2 KB (added by desrosj, 12 months ago)
  • src/wp-includes/nav-menu.php

     
    9292
    9393        add_theme_support( 'menus' );
    9494
     95        foreach ( $locations as $key => $value ) {
     96                if ( is_int( $key ) ) {
     97                        _doing_it_wrong( __FUNCTION__, __( 'Nav menu locations must be strings.' ), '5.3' );
     98                        break;
     99                }
     100        }
     101
    95102        $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
    96103}
    97104
  • tests/phpunit/tests/menu/nav-menu.php

     
    182182        /**
    183183         * Technically possible to register menu locations numerically.
    184184         *
     185         * @expectedIncorrectUsage register_nav_menus
     186         *
    185187         * @covers ::wp_map_nav_menu_locations()
    186188         */
    187189        function test_numerical_locations() {
     
    205207        /**
    206208         * Technically possible old nav menu locations were registered numerically.
    207209         *
     210         * @expectedIncorrectUsage register_nav_menus
     211         *
    208212         * @covers wp_map_nav_menu_locations()
    209213         */
    210214        public function test_numerical_old_locations() {