Make WordPress Core

Changes between Version 3 and Version 9 of Ticket #56664


Ignore:
Timestamp:
09/27/2022 08:11:28 AM (4 years ago)
Author:
aristath
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #56664

    • Property Keywords has-unit-tests added; reporter-feedback removed
    • Property Severity changed from major to normal
    • Property Summary changed from Blocks try to load non-existent block-styles on the frontend to Add unit test for non-existing block-styles registration
  • Ticket #56664 – Description

    v3 v9  
    1 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.
    2 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;`.
    3 
    4 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.
     1Adds PHPUnit test for https://core.trac.wordpress.org/changeset/54155