[wp-trac] [WordPress Trac] #58711: register_core_block_style_handles() does not enqueue styles on Windows OS
WordPress Trac
noreply at wordpress.org
Wed Jul 5 02:38:50 UTC 2023
#58711: register_core_block_style_handles() does not enqueue styles on Windows OS
--------------------------+-----------------------------
Reporter: wildworks | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Originally reported in the Gutenberg repository:
https://github.com/WordPress/gutenberg/issues/52199
This problem only occurs when WordPress itself is running on the Windows
host OS; when the WordPress repository is running via npm script,
WordPress is running on Docker (on Ubuntu), so this problem should not be
reproducible. Running the built source or a released package (such as the
Beta3 version) in a local environment on a Windows OS would reproduce this
problem.
This function uses the `glob` function to locate CSS files under `wp-
includes/blocks`. In this case, `$files` variable has the following value
on Windows OS:
{{{
array(
// ...
"D:\_local\test\wp6.3\app\public\wp-
includes\blocks/archives/editor.min.css"
"D:\_local\test\wp6.3\app\public\wp-
includes\blocks/archives/style.min.css"
// ...
);
}}}
Note the mix of forward slash and backslash as path separators.
On the other hand, the `$path` in `$register_style` function has the
following value:
{{{
"D:\_local\test\wp6.3\app\public/wp-
includes/blocks/archives/editor.min.css"
}}}
{{{
"D:\_local\test\wp6.3\app\public/wp-
includes/blocks/archives/style.min.css"
}}}
Comparing with the value that the `$files` array has, you can see that
some path separators are different. As a result, the check by `in_array(
$path, $files, true )` will be `false` and the style will not be enqueued.
We probably need to unify the path separator characters in some way, as I
expect this problem to occur on all Windows OS.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58711>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list