[wp-trac] [WordPress Trac] #57583: Add support for editing block style variations in the global styles

WordPress Trac noreply at wordpress.org
Mon Feb 6 18:29:24 UTC 2023


#57583: Add support for editing block style variations in the global styles
-------------------------------------------------+-------------------------
 Reporter:  isabel_brison                        |       Owner:
                                                 |  hellofromTonya
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.2
Component:  Editor                               |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch gutenberg-merge has-       |     Focuses:
  testing-info has-unit-tests commit             |
-------------------------------------------------+-------------------------

Comment (by hellofromTonya):

 The most recent test runs show it at line 860 as @isabel_brison noted. The
 `Warning` is on PHP 8+. Looking at the code before going into the
 `foreach`, it's checking for a non-empty value, but not where it's also an
 array:

 {{{#!php
 if ( ! empty( $block_type->styles ) ) {
 }}}

 In my mind, I'm thinking about:

 * Could the `styles` property ever be a non-empty that's not an array?
 * If maybe, then an `is_array( $block_type->styles )` would skip the
 `foreach` for a non-empty string or any other non-empty array values.
 * Else, look at the test to see which one is causing this to determine if
 there's a bug somewhere in the code that's causing the unexpected value
 and data type.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57583#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list