[wp-trac] [WordPress Trac] #64545: Style Engine: Harden add_declaration against being passed illegal values
WordPress Trac
noreply at wordpress.org
Fri Jan 23 04:51:25 UTC 2026
#64545: Style Engine: Harden add_declaration against being passed illegal values
--------------------------+-----------------------------
Reporter: andrewserong | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0
Component: Editor | Version: trunk
Severity: normal | Keywords: gutenberg-merge
Focuses: |
--------------------------+-----------------------------
Currently the add_declaration method assumes that it has been passed a
string, when it might not have been.
I noticed on a website that someone had malformed block markup that nested
`margin` within the `spacing.padding` object for a block, instead of
having `margin` be a sibling to `padding`. These sorts of issues should
generally fail silently rather than throwing an error.
It turns out that block spacing is passed on by the layout block support
to the Style Engine, where it assumes the properties and values are
correct.
We can harden against these sorts of circumstances by ensuring that the
Style Engine bails early if it isn't given a string when adding a
declaration.
This has already been fixed in Gutenberg, and this ticket proposes
including the fix in core. The Gutenberg PR is:
https://github.com/WordPress/gutenberg/pull/74881
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64545>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list