[wp-trac] [WordPress Trac] #64848: WP_Theme_JSON: Prevent implicit coercion in to_ruleset

WordPress Trac noreply at wordpress.org
Thu Mar 12 07:06:39 UTC 2026


#64848: WP_Theme_JSON: Prevent implicit coercion in to_ruleset
-------------------------+-------------------------------------------------
 Reporter:  ramonopoly   |      Owner:  (none)
     Type:  defect       |     Status:  new
  (bug)                  |
 Priority:  normal       |  Milestone:  7.1
Component:  Themes       |    Version:  5.8
 Severity:  minor        |   Keywords:  has-patch gutenberg-merge has-unit-
  Focuses:               |  tests
-------------------------+-------------------------------------------------
 `WP_Theme_JSON::to_ruleset` used string concatenation (`$element['name'] .
 ': ' . $element['value'] . ';'`), so PHP implicitly coerced non-string
 values (e.g. booleans → `'1'`/`''`, arrays → `'Array'`). That could emit
 invalid or misleading CSS.

 I caught this while debugging the
 `test_get_styles_with_appearance_tools()` test, which was outputting
 values like `gap: 1` where `1` was the result of coercing a `bool`.

 The `bool` was the block support value, not a gap value.

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


More information about the wp-trac mailing list