Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#63572 new defect (bug)

theme.json file variable could be a directory, add check to prevent notices

Reported by: ramon-fincken's profile ramon fincken Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Themes Keywords: has-patch
Focuses: Cc:

Description

In class-wp-theme-json-resolver.php

https://github.com/WordPress/wordpress-develop/blob/6.8.1/src/wp-includes/class-wp-theme-json-resolver.php#L254

is the line

if ( is_readable( $theme_json_file ) ) {

However if the $theme_json_file is a directory that will return true, even if it expects a .json local file path.

In this patch I propose adding is_file ( and perhaps even removing is_readable, as is_readable will also return true for directories ).

Change History (1)

This ticket was mentioned in PR #8988 on WordPress/wordpress-develop by @ramon fincken.


3 weeks ago
#1

In this patch I propose adding is_file ( and perhaps even removing is_readable, as is_readable will also return true for directories ).

Trac
https://core.trac.wordpress.org/ticket/63572#ticket

Note: See TracTickets for help on using tickets.