Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#53599 new defect (bug)

WP_Theme::get_files() returns unexpected entry if parent theme not available.

Reported by: dd32 Owned by:
Milestone: 5.9 Priority: normal
Severity: minor Version:
Component: Themes Keywords: needs-patch needs-unit-tests good-first-bug
Focuses: Cc:


Given the following code, you'll get a slightly unexpected output if the parent theme is not available.

$theme = new WP_Theme( ... );
$files = $theme->get_files(
	null /* all file types */,
	-1 /* infinite recursion */,
	true /* include parent theme files */
var_dump( $files );

Expected output:

array (size=1)
  'index.php' => string '/tmp/test-theme/index.php' (length=25)

Actual output:

array (size=2)
  'index.php' => string '/tmp/test-theme/index.php' (length=25)
   0 => boolean false

I believe the inclusion of 0 as the filename, and false as the path is rather unexpected

Attachments (1)

53599.patch (650 bytes) - added by opurockey 8 days ago.
Added patch.

Download all attachments as: .zip

Change History (2)

#1 @SergeyBiryukov
4 weeks ago

  • Milestone changed from Awaiting Review to 5.9

8 days ago

Added patch.

Note: See TracTickets for help on using tickets.