Make WordPress Core

Ticket #59018: 59018.diff

File 59018.diff, 1.8 KB (added by azaozz, 14 months ago)
  • src/wp-includes/blocks.php

     
    137137        // Cache $template_path_norm and $stylesheet_path_norm to avoid unnecessary additional calls.
    138138        static $template_path_norm   = '';
    139139        static $stylesheet_path_norm = '';
     140
     141        // Trailing slashes are needed to properly match parent and child themes directories with similar names.
    140142        if ( ! $template_path_norm || ! $stylesheet_path_norm ) {
    141                 $template_path_norm   = wp_normalize_path( get_template_directory() );
    142                 $stylesheet_path_norm = wp_normalize_path( get_stylesheet_directory() );
     143                $template_path_norm   = trailingslashit( wp_normalize_path( get_template_directory() ) );
     144                $stylesheet_path_norm = trailingslashit( wp_normalize_path( get_stylesheet_directory() ) );
    143145        }
    144146
    145147        $script_path_norm = wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $script_path ) );
     
    254256                // Cache $template_path_norm and $stylesheet_path_norm to avoid unnecessary additional calls.
    255257                static $template_path_norm   = '';
    256258                static $stylesheet_path_norm = '';
     259
     260                // Trailing slashes are needed to properly match parent and child themes directories with similar names.
    257261                if ( ! $template_path_norm || ! $stylesheet_path_norm ) {
    258                         $template_path_norm   = wp_normalize_path( get_template_directory() );
    259                         $stylesheet_path_norm = wp_normalize_path( get_stylesheet_directory() );
     262                        $template_path_norm   = trailingslashit( wp_normalize_path( get_template_directory() ) );
     263                        $stylesheet_path_norm = trailingslashit( wp_normalize_path( get_stylesheet_directory() ) );
    260264                }
    261265
    262266                // Determine if the block style was registered in a theme, by checking if the script path starts with either