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. Built from https://develop.svn.wordpress.org/trunk@56136 git-svn-id: http://core.svn.wordpress.org/trunk@55648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a295a53218
commit
900a79dc53
|
@ -48,16 +48,16 @@ function register_core_block_style_handles() {
|
||||||
$transient_name = 'wp_core_block_css_files';
|
$transient_name = 'wp_core_block_css_files';
|
||||||
$files = get_transient( $transient_name );
|
$files = get_transient( $transient_name );
|
||||||
if ( ! $files ) {
|
if ( ! $files ) {
|
||||||
$files = glob( __DIR__ . '/**/**.css' );
|
$files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
|
||||||
set_transient( $transient_name, $files );
|
set_transient( $transient_name, $files );
|
||||||
}
|
}
|
||||||
} else {
|
} 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 ) {
|
$register_style = static function( $name, $filename, $style_handle ) use ( $includes_path, $includes_url, $suffix, $wp_styles, $files ) {
|
||||||
$style_path = "blocks/{$name}/{$filename}{$suffix}.css";
|
$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 ) ) {
|
if ( ! in_array( $path, $files, true ) ) {
|
||||||
$wp_styles->add(
|
$wp_styles->add(
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-beta3-56135';
|
$wp_version = '6.3-beta3-56136';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue