diff --git src/wp-includes/nav-menu.php src/wp-includes/nav-menu.php
index f130d2f3e1..ba1d777bbb 100644
|
|
function register_nav_menus( $locations = array() ) { |
92 | 92 | |
93 | 93 | add_theme_support( 'menus' ); |
94 | 94 | |
| 95 | foreach ( $locations as $key => $value ) { |
| 96 | if ( is_int( $key ) ) { |
| 97 | $message = __( 'Strings should always be used for menu location slugs.' ); |
| 98 | _doing_it_wrong( __FUNCTION__, $message, '5.3' ); |
| 99 | break; |
| 100 | } |
| 101 | } |
| 102 | |
95 | 103 | $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations ); |
96 | 104 | } |
97 | 105 | |
diff --git tests/phpunit/tests/menu/nav-menu.php tests/phpunit/tests/menu/nav-menu.php
index 2627f9f21a..4577f5e9a9 100644
|
|
class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase { |
182 | 182 | /** |
183 | 183 | * Technically possible to register menu locations numerically. |
184 | 184 | * |
| 185 | * @expectedIncorrectUsage register_nav_menus |
| 186 | * |
185 | 187 | * @covers ::wp_map_nav_menu_locations() |
186 | 188 | */ |
187 | 189 | function test_numerical_locations() { |
… |
… |
class Tests_Nav_Menu_Theme_Change extends WP_UnitTestCase { |
205 | 207 | /** |
206 | 208 | * Technically possible old nav menu locations were registered numerically. |
207 | 209 | * |
| 210 | * @expectedIncorrectUsage register_nav_menus |
| 211 | * |
208 | 212 | * @covers wp_map_nav_menu_locations() |
209 | 213 | */ |
210 | 214 | public function test_numerical_old_locations() { |