[wp-trac] [WordPress Trac] #57928: Prevent loading wp-content/themes/functions.php when 'stylesheet' option is empty
WordPress Trac
noreply at wordpress.org
Wed Mar 15 15:01:33 UTC 2023
#57928: Prevent loading wp-content/themes/functions.php when 'stylesheet' option is
empty
-----------------------------+------------------------------
Reporter: danielbachhuber | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bootstrap/Load | Version:
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
-----------------------------+------------------------------
Changes (by danielbachhuber):
* keywords: dev-feedback reporter-feedback => dev-feedback
Comment:
Replying to [comment:4 hellofromTonya]:
> In that line of thinking:
>
> What if there is a real-world use case for `WP_CONTENT_DIR .
'/themes/functions.php'` to exist? If there is, then returning empty
strings from `wp_get_active_and_valid_themes()` would break loading that
file on those sites.
Personally, I think it's fine to make this change. It's a ''bug'' that
WordPress is doing this in the first place, not a documented feature.
The actual bug seems like it's that `TEMPLATEPATH` and `STYLESHEETPATH`
are set to paths when `template` and `stylesheet` are empty. It seems like
they should be defined to `false`. However, changing this particular
behavior increases our surface area for unexpected side effects.
> Is `wp_get_active_and_valid_themes()` intentionally designed to allow
only pointing at the main themes directory (root)? Or is this an
oversight? hmm
That sounds like a different bug report :D
> > Create a `functions.php` file with a syntax error or an undefined
function like `<?php genesis_register_sidebar();` and place under `/wp-
content/themes/`
>
> Is there a real-world use case where that file would exist?
The problem has manifested in the real world at least a couple of times
now. It's certainly an edge case, though.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57928#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list