[wp-trac] [WordPress Trac] #56664: Blocks try to load non-existent block-styles on the frontend

WordPress Trac noreply at wordpress.org
Tue Sep 27 05:57:25 UTC 2022


#56664: Blocks try to load non-existent block-styles on the frontend
--------------------------+--------------------
 Reporter:  aristath      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  6.1
Component:  General       |    Version:  trunk
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+--------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56664>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list