Footnotes: autosave is not slashing JSON#53664
Merged
Conversation
|
Size Change: +40 B (0%) Total Size: 1.51 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in dfd972e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5864772264
|
ramonjd
reviewed
Aug 15, 2023
| } | ||
|
|
||
| update_post_meta( $id, 'footnotes', $body['meta']['footnotes'] ); | ||
| update_post_meta( $id, 'footnotes', wp_slash( $body['meta']['footnotes'] ) ); |
Member
There was a problem hiding this comment.
Auto saving still triggers the count() error for me, but not when I add wp_slash() to the update in wp_save_footnotes_meta, e.g.,
update_metadata( 'post', $revision_id, 'footnotes', wp_slash( $footnotes ) );I guess that's being called as well?
Member
Contributor
|
Thanks for fixing this! |
tellthemachines
pushed a commit
that referenced
this pull request
Aug 16, 2023
* Footnotes: autosave saves decoded JSON * wp_slash * Curly quote * Slash on save and restore
tellthemachines
added a commit
that referenced
this pull request
Aug 16, 2023
* Footnotes: Fix recursion into updating attributes when attributes is not an object (#53257) * Fix crash by moving editor style logic into a hook with useMemo (#53596) * Move editor style logic into a hook whith useMemo * Remove unnecessary useMemo * Move the whole logic inside the 'useMemo' * Add missing useSelect dep --------- Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> * Adding an is_array check before using count in case $footnotes is not countable (#53660) * Footnotes: fix accidental override (#53663) * Footnotes: fix accidental override * Remove double quotes * Footnotes: autosave is not slashing JSON (#53664) * Footnotes: autosave saves decoded JSON * wp_slash * Curly quote * Slash on save and restore * Ensure the preview dropdown popover closes (<16.3) for e2e tests --------- Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Co-authored-by: Noah Allen <noahtallen@gmail.com> Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> Co-authored-by: Ramon <ramonjd@users.noreply.github.com> Co-authored-by: Ella <4710635+ellatrix@users.noreply.github.com> Co-authored-by: ramon <ramonjd@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What?
Fixes #53660, https://core.trac.wordpress.org/ticket/59103
Why?
We're making this mistake:
https://developer.wordpress.org/reference/functions/update_post_meta/#character-escaping
This is what the REST API does:
https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php#L393
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast