From c3e17e4ccbdd73102e7eab844c79687f71233392 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Wed, 5 Jul 2023 07:14:20 +0000 Subject: [PATCH] Editor: Normalize paths in `register_core_block_style_handles()`. Previously, this function did not normalize paths before using `glob()` or registering styles. This led to a mixture of forward-slashes and back-slashes in Windows environments. This change uses `wp_normalize_path()` to ensure Windows compatibility. Props wildworks, costdev, kafleg, mukesh27. Fixes #58711. git-svn-id: https://develop.svn.wordpress.org/trunk@56136 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/blocks/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/blocks/index.php b/src/wp-includes/blocks/index.php index f9ffa411af..23cbc78d26 100644 --- a/src/wp-includes/blocks/index.php +++ b/src/wp-includes/blocks/index.php @@ -48,16 +48,16 @@ function register_core_block_style_handles() { $transient_name = 'wp_core_block_css_files'; $files = get_transient( $transient_name ); if ( ! $files ) { - $files = glob( __DIR__ . '/**/**.css' ); + $files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) ); set_transient( $transient_name, $files ); } } else { - $files = glob( __DIR__ . '/**/**.css' ); + $files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) ); } $register_style = static function( $name, $filename, $style_handle ) use ( $includes_path, $includes_url, $suffix, $wp_styles, $files ) { $style_path = "blocks/{$name}/{$filename}{$suffix}.css"; - $path = $includes_path . $style_path; + $path = wp_normalize_path( $includes_path . $style_path ); if ( ! in_array( $path, $files, true ) ) { $wp_styles->add(