Make WordPress Core


Ignore:
Timestamp:
11/20/2023 10:27:17 PM (5 months ago)
Author:
joemcgill
Message:

Themes: Remove memoization from stylesheet and theme directories.

This fixes bugs introduced in [56635] whereby the template or stylesheet path could be memoized incorrectly if get_template_directory() or get_stylesheet_directory() were called before the theme has been fully initialized.

Props partyfrikadelle, coreyw, kdowns, rebasaurus, meta4, flixos90, mukesh27, joemcgill.
Fixes #59847.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-blogs.php

    r56974 r57129  
    492492 * @global bool            $switched
    493493 * @global string          $table_prefix
    494  * @global string          $wp_template_path
    495  * @global string          $wp_stylesheet_path
    496494 * @global WP_Object_Cache $wp_object_cache
    497495 *
     
    535533
    536534    $wpdb->set_blog_id( $new_blog_id );
    537     $GLOBALS['table_prefix']       = $wpdb->get_blog_prefix();
    538     $GLOBALS['blog_id']            = $new_blog_id;
    539     $GLOBALS['wp_template_path']   = null;
    540     $GLOBALS['wp_stylesheet_path'] = null;
     535    $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
     536    $GLOBALS['blog_id']      = $new_blog_id;
    541537
    542538    if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
     
    605601 * @global bool            $switched
    606602 * @global string          $table_prefix
    607  * @global string          $wp_template_path
    608  * @global string          $wp_stylesheet_path
    609603 * @global WP_Object_Cache $wp_object_cache
    610604 *
     
    632626
    633627    $wpdb->set_blog_id( $new_blog_id );
    634     $GLOBALS['blog_id']            = $new_blog_id;
    635     $GLOBALS['table_prefix']       = $wpdb->get_blog_prefix();
    636     $GLOBALS['wp_template_path']   = null;
    637     $GLOBALS['wp_stylesheet_path'] = null;
     628    $GLOBALS['blog_id']      = $new_blog_id;
     629    $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
    638630
    639631    if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
Note: See TracChangeset for help on using the changeset viewer.