Make WordPress Core

Opened 3 years ago

Last modified 13 months ago

#23405 closed defect (bug)

blog-details cache can get stuck with bad value — at Version 1

Reported by: westi Owned by:
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.5.1
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description (last modified by westi)

If you call get_blog_details for a blog which doesn't exist yet in wp_blogs then we cache a negative lookup result as -1:


        if ( empty($details) ) {
                $details = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE blog_id = %d /* get_blog_details */", $blog_id ) );
                if ( ! $details ) {
                        // Set the full cache.
                        wp_cache_set( $blog_id, -1, 'blog-details' );
                        return false;

When you then later call refresh_blog_details to clear up the cache for the blog_id the cached -1 is passed to clean_blog_cache which then tries to get a blog_id from the object that was returned and doesn't get the right one and the cached are not deleted.

This means that the blog ends up broken :(

Change History (1)

#1 @westi
3 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.