WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 8 months ago

#22336 new defect (bug)

WP_Theme::get_allowed_on_site() function doesn't work for other blogs

Reported by: npetetin Owned by:
Priority: normal Milestone: Awaiting Review
Component: Themes Version: 3.4.2
Severity: major Keywords:
Cc:

Description

On line 1110, the static function WP_Theme::get_allowed_on_site() overwrites the $blog_id argument:

$current = $blog_id == get_current_blog_id();

As a consequence, calling the function for another blog than the current blog is made impossible. It doesn't look fixed in WP 3.5 either.

Change History (2)

comment:1 SergeyBiryukov8 months ago

That line only assigns a boolean value to $current, it doesn't change $blog_id.

comment:2 npetetin8 months ago

My mistake, you're perfectly right. I've been a bit fast in my troubleshooting.

However, there's definitely an issue with the new 3.4 implementation. Why using the static $allowed_themes? For caching purpose? If yes, options and blog options are already fully cached, aren't they?

The issue is that with this additional "caching system", the calls to 'get_option' and 'get_blog_option' are bypassed and then filters are not applied anymore. If for any good reason a plugin adds a filter on 'allowed_themes' option after the static function is called for the first time, the result is never filtered, am I wrong?

Thanks.

Note: See TracTickets for help on using tickets.