Skip to content

Commit 1edae38

Browse files
Themes: Avoid a PHP 7.2 warning in get_theme_roots() when $wp_theme_directories is an uncountable value.
See [41174] for `wp_get_themes()` and `get_raw_theme_root()`. Props burlingtonbytes, teddytime, lbenicio, desrosj. Merges [43039] to the 4.9 branch. Fixes #43374. See #40109. git-svn-id: https://develop.svn.wordpress.org/branches/4.9@43040 602fd350-edb4-49c9-b593-d223f7449a82
1 parent dae28e7 commit 1edae38

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/wp-includes/theme.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,9 @@ function get_template_directory_uri() {
353353
function get_theme_roots() {
354354
global $wp_theme_directories;
355355

356-
if ( count($wp_theme_directories) <= 1 )
356+
if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
357357
return '/themes';
358+
}
358359

359360
$theme_roots = get_site_transient( 'theme_roots' );
360361
if ( false === $theme_roots ) {

0 commit comments

Comments
 (0)