Themes: Fix core block style paths on Windows.

This is a follow-up to [56528], which normalizes the `BLOCKS_PATH` for Windows prior to making paths relative for caches during the registration process. Prior to 
this change, incorrect file paths would lead to broken styles for core blocks on Windows.

Props wildworks, pbiron, flixos90, joemcgill.
Merges [56785] to the 6.3 branch.
Fixes . See .





git-svn-id: https://develop.svn.wordpress.org/branches/6.3@56789 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras 2023-10-05 17:13:09 +00:00
parent 39fde8bab5
commit 50ba54d318

@ -68,9 +68,13 @@ function register_core_block_style_handles() {
if ( ! $files ) {
$files = glob( wp_normalize_path( BLOCKS_PATH . '**/**.css' ) );
// Normalize BLOCKS_PATH prior to substitution for Windows environments.
$normalized_blocks_path = wp_normalize_path( BLOCKS_PATH );
$files = array_map(
static function ( $file ) {
return str_replace( BLOCKS_PATH, '', $file );
static function ( $file ) use ( $normalized_blocks_path ) {
return str_replace( $normalized_blocks_path, '', $file );
},
$files
);