Repository navigation
Commit fd20633
committed
KSES: Only serialize non-empty block JSON attributes.
In r64255 `wp_kses()` completely reserializes every block delimiter, including any JSON attributes. Unfortunately, if a delimiter contained no JSON attributes, but still presented an empty JSON map, these attributes would be re-serialized as an empty list due to the ambiguity of empty PHP arrays. This led to blocks no-longer parsing as blocks.
wp_kses( '<!-- wp:block {} -->' ) // turns into `<!-- wp:block [] -->`
This patch checks if any attributes exist before serializing them into the block delimiter. There is a pre-existing version of this problem in WordPress for block JSON attributes whose value is an empty map, but r64255 did not change how those are modified through `wp_kses()`.
Developed in: #14136
Discussed in: https://core.trac.wordpress.org/ticket/66208
Follow-up to: r64255.
Props bjorsch, dmsnell.
See #66208.
git-svn-id: https://develop.svn.wordpress.org/trunk@64258 602fd350-edb4-49c9-b593-d223f7449a821 parent 3591842 commit fd20633
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1705 | 1705 | | |
1706 | 1706 | | |
1707 | 1707 | | |
1708 | | - | |
| 1708 | + | |
1709 | 1709 | | |
1710 | 1710 | | |
1711 | 1711 | | |
| |||
0 commit comments