Make WordPress Core

Changeset 56136


Ignore:
Timestamp:
07/05/2023 07:14:20 AM (23 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/index.php

    r56064 r56136  
    4949        $files          = get_transient( $transient_name );
    5050        if ( ! $files ) {
    51             $files = glob( __DIR__ . '/**/**.css' );
     51            $files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
    5252            set_transient( $transient_name, $files );
    5353        }
    5454    } else {
    55         $files = glob( __DIR__ . '/**/**.css' );
     55        $files = glob( wp_normalize_path( __DIR__ . '/**/**.css' ) );
    5656    }
    5757
    5858    $register_style = static function( $name, $filename, $style_handle ) use ( $includes_path, $includes_url, $suffix, $wp_styles, $files ) {
    5959        $style_path = "blocks/{$name}/{$filename}{$suffix}.css";
    60         $path       = $includes_path . $style_path;
     60        $path       = wp_normalize_path( $includes_path . $style_path );
    6161
    6262        if ( ! in_array( $path, $files, true ) ) {
Note: See TracChangeset for help on using the changeset viewer.