Nav Menus: Fix a PHP 7.3 error when switching themes.
When switching themes, `wp_map_nav_menu_locations()` is used to ensure nav menus are placed in the relevant menu location. Occasionally, menus are registered to locations with numeric slugs, rather than strings. `wp_map_nav_menu_locations()` assumed it would be the latter, and ran `stripos()` on those numeric slugs. This behaviour is deprecated in PHP 7.3. As this is the last known PHP 7.3 incompatibility, this commit also removes PHP 7.3 from Travis' `allowed_failures` list. Props desrosj, jorbin. See #45018. Built from https://develop.svn.wordpress.org/branches/5.0@43899 git-svn-id: http://core.svn.wordpress.org/branches/5.0@43731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
73a19c6116
commit
80dd8b9b83
|
@ -1139,7 +1139,9 @@ function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locat
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -1150,7 +1152,9 @@ function wp_map_nav_menu_locations( $new_nav_menu_locations, $old_nav_menu_locat
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.0-beta4-43898';
|
||||
$wp_version = '5.0-beta4-43899';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue