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

WordPress Trac noreply at wordpress.org
Mon May 11 02:04:21 UTC 2026


#64848: WP_Theme_JSON: Prevent implicit coercion in to_ruleset
-------------------------------------------------+-------------------------
 Reporter:  ramonopoly                           |       Owner:  ramonopoly
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  7.1
Component:  Themes                               |     Version:  5.8
 Severity:  minor                                |  Resolution:  fixed
 Keywords:  has-patch gutenberg-merge has-unit-  |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by ramonopoly):

 * owner:  (none) => ramonopoly
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"62347" 62347]:
 {{{
 #!CommitTicketReference repository="" revision="62347"
 WP_Theme_JSON: Prevent implicit coercion in to_ruleset

 `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.

 At the same time, pass a `style` theme.json path in
 `test_get_styles_with_appearance_tools()` to simulate a style node. Before
 it was `settings`.

 Props ramonopoly, andrewserong, isabel_brison.

 Fixes #64848.

  --This line, and those below, will be ignored--

 M    src/wp-includes/class-wp-theme-json.php
 M    tests/phpunit/tests/theme/wpThemeJson.php
 }}}

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


More information about the wp-trac mailing list