[wp-trac] [WordPress Trac] #31620: get_raw_theme_root does not resolve custom theme folder when is the unique
WordPress Trac
noreply at wordpress.org
Fri Jul 3 18:21:44 UTC 2015
#31620: get_raw_theme_root does not resolve custom theme folder when is the unique
-------------------------------------+------------------------------
Reporter: giuseppe.mazzapica | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+------------------------------
Comment (by McGuive7):
Thanks for the feedback guys. Just updated the patch to include
wp_normalize_path() in place of realpath(). Invaluable to get your
feedback and learn something new - thanks!
One other concern, and this may be a non-issue however I'd love to get a
2nd opinion. It has to do with this line of code:
{{{
return strpos( $theme_path_normalized, $content_path_normalized ) === 0 ?
substr( $theme_path_normalized, strlen( $content_path_normalized ) ) :
$theme_path_normalized;
}}}
This conditional seems a bit odd to me. If it resolves to true (aka the
theme path starts with the content path) then we return a relative path to
the themes folder - in most cases this is `/themes`.
If the conditional fails, however, then we end up returning the normalized
theme path (not relative URL or directory), which ends up being something
like `/srv/www/wordpress-develop/src/wp-content/themes`.
Seems like a fault that the function could return a relative path when
it's pointing to a theme directory within the content directory, but to a
full path otherwise. Now, to be fair, it seems like the only way this
would happen is if someone deregistered the default themes directory
entirely, and then registered a new directory that is not in the content
directory, but if this conditional check is going to be there at all, it
seems like we may want to attempt to get the relative path of the custom
directory instead of its full path, right? Thoughts?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31620#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list