Themes: Ensure `WP_Theme::get_files()` doesn't return unexpected values.

This change filters out empty entries from `WP_Theme::get_files()` before returning the array of files. This avoid returning an entry with `false` value when the directory of the theme does not exist.

Props dd32, opurockey, Rahmohn, audrasjb.
Fixes #53599.

Built from https://develop.svn.wordpress.org/trunk@53253


git-svn-id: http://core.svn.wordpress.org/trunk@52842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-04-25 09:46:08 +00:00
parent 2c0a330fba
commit 50050b2f59
2 changed files with 2 additions and 2 deletions

View File

@ -1210,7 +1210,7 @@ final class WP_Theme implements ArrayAccess {
$files += (array) self::scandir( $this->get_template_directory(), $type, $depth ); $files += (array) self::scandir( $this->get_template_directory(), $type, $depth );
} }
return $files; return array_filter( $files );
} }
/** /**

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.0-beta2-53252'; $wp_version = '6.0-beta2-53253';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.