Index: src/wp-includes/nav-menu.php
===================================================================
--- src/wp-includes/nav-menu.php	(revision 43896)
+++ src/wp-includes/nav-menu.php	(working copy)
@@ -1139,8 +1139,10 @@
 			foreach ( $registered_nav_menus as $new_location => $name ) {
 
 				// ...actually match!
-				if ( false === stripos( $new_location, $slug ) && false === stripos( $slug, $new_location ) ) {
+				if ( is_string( $new_location ) && false === stripos( $new_location, $slug ) && false === stripos( $slug, $new_location ) ) {
 					continue;
+				} elseif ( is_numeric( $new_location ) && $new_location !== $slug ) {
+					continue;
 				}
 
 				// Then see if any of the old locations...
@@ -1150,8 +1152,10 @@
 					foreach ( $slug_group as $slug ) {
 
 						// ... have a match as well.
-						if ( false === stripos( $location, $slug ) && false === stripos( $slug, $location ) ) {
+						if ( is_string( $location ) && false === stripos( $location, $slug ) && false === stripos( $slug, $location ) ) {
 							continue;
+						} elseif ( is_numeric( $location ) && $location !== $slug ) {
+							continue;
 						}
 
 						// Make sure this location wasn't mapped and removed previously.
Index: tests/phpunit/tests/menu/nav-menu.php
===================================================================
--- tests/phpunit/tests/menu/nav-menu.php	(revision 43896)
+++ tests/phpunit/tests/menu/nav-menu.php	(working copy)
@@ -200,4 +200,26 @@
 		);
 		$this->assertEqualSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
 	}
+
+	/**
+	 * Technically possible old nav menu locations were registered numerically.
+	 *
+	 * @covers wp_map_nav_menu_locations()
+	 */
+	public function test_numerical_old_locations() {
+		$this->register_nav_menu_locations( array( 'primary', 1 ) );
+		$old_nav_menu_locations = array(
+			'primary'  => 1,
+			1          => 2,
+			'tertiary' => 3,
+		);
+
+		$old_next_theme_nav_menu_locations = array();
+		$new_next_theme_nav_menu_locations = wp_map_nav_menu_locations( $old_next_theme_nav_menu_locations, $old_nav_menu_locations );
+		$expected_nav_menu_locations       = array(
+			'primary' => 1,
+			1         => 2,
+		);
+		$this->assertEqualSets( $expected_nav_menu_locations, $new_next_theme_nav_menu_locations );
+	}
 }
