From 219de8acd55af24c3d9c69e97cb3a3d7f05c30d2 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Thu, 27 Jul 2017 17:00:44 +0000 Subject: [PATCH] General: Avoid counting uncountable values when reading theme directories, and in some unit tests. See #40109 Built from https://develop.svn.wordpress.org/trunk@41174 git-svn-id: http://core.svn.wordpress.org/trunk@41014 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/theme.php | 5 +++-- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 3c908f1820..b1d85e6f94 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -35,7 +35,7 @@ function wp_get_themes( $args = array() ) { $theme_directories = search_theme_directories(); - if ( count( $wp_theme_directories ) > 1 ) { + if ( is_array( $wp_theme_directories ) && count( $wp_theme_directories ) > 1 ) { // Make sure the current theme wins out, in case search_theme_directories() picks the wrong // one in the case of a conflict. (Normally, last registered theme root wins.) $current_theme = get_stylesheet(); @@ -627,8 +627,9 @@ function get_theme_root_uri( $stylesheet_or_template = false, $theme_root = fals function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) { global $wp_theme_directories; - if ( count($wp_theme_directories) <= 1 ) + if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) { return '/themes'; + } $theme_root = false; diff --git a/wp-includes/version.php b/wp-includes/version.php index 509a0ae58e..69b7496e3b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41173'; +$wp_version = '4.9-alpha-41174'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.