Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Trac ticket: Core-66208
When r64255 was added, normalizing all block delimiters inside `wp_kses()`, if a block contained an empty set of JSON attributes, but the JSON `{}` was present on the delimiter, then it would be reserialized as `[]` and misparse later.
This patch fixes that to only print the serialized attributes if there are any, implying a JSON object rather than an array.
Follow-up to: r64255
Co-Authored-By: Brad Jorsch <bjorsch@git.wordpress.org>
167c9f7 to
c7844df
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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-d223f7449a82
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: WordPress/wordpress-develop#14136 Discussed in: https://core.trac.wordpress.org/ticket/66208 Follow-up to: r64255. Props bjorsch, dmsnell. See #66208. Built from https://develop.svn.wordpress.org/trunk@64258 git-svn-id: http://core.svn.wordpress.org/trunk@63409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: Core-66208
See #8789
When r64255 was added, normalizing all block delimiters inside
wp_kses(), if a block contained an empty set of JSON attributes, but the JSON{}was present on the delimiter, then it would be reserialized as[]and misparse later.This patch fixes that to only print the serialized attributes if there are any, implying a JSON object rather than an array.
Follow-up to: r64255