[wp-trac] [WordPress Trac] #56664: Add unit test for non-existing block-styles registration (was: Blocks try to load non-existent block-styles on the frontend)
WordPress Trac
noreply at wordpress.org
Tue Sep 27 08:11:28 UTC 2022
#56664: Add unit test for non-existing block-styles registration
--------------------------------------+---------------------
Reporter: aristath | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.1
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+---------------------
Changes (by aristath):
* severity: major => normal
Old description:
> There's a small error in the `register_block_style_handle()` function
> which prevents us from properly determining if a stylesheet for a block
> exists or now.
> We use `$style_path_norm = wp_normalize_path( realpath( dirname(
> $metadata['file'] ) . '/' . $style_path ) );` to get the stylesheet's
> path, and then we check if the file exists by doing `$has_style_file =
> false !== $style_path_norm;`.
>
> The problem is that `realpath()` returns`false` if the file does not
> exist, however it then passes through `wp_normalize_path()` and the
> `false` value gets converted to an empty string - therefore making the
> `false !== $style_path_norm` condition to fail.
New description:
Adds PHPUnit test for https://core.trac.wordpress.org/changeset/54155
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56664#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list