-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ampersand's in the Navigation block are converted to u0026 #59516
Comments
Adding to 6.5 but let's test with 6.4.3 to ensure this is related to the 6.5 release. If no one beats me to it, I'll do that tomorrow (@fabiankaegy in case you can!) |
I just tested this and was able to verify that it is not happening in 6.4.3 but is happening on 6.5 Beta 3. |
@getdave Tagging you here as one of the maintainers of the Navigation Block |
I can replicate. Likely to due to how label is escaped in the I'm going to recommend that whatever fix we implement we add test coverage for in a follow up as similar issues have occurred a few times now. |
Testing I found the following is stored in the database
Notice the I tested with removing the escaping in
...and it does change the conversion to entities. |
Could there be any other unrelated change in WordPress core that would have this effect on escaping / uescaping characters in the DB? |
Highly likely. The code I highlighted above is non-standard and only exists for historical reasons. So it's possible that there's a change in Core which has caused this hack to come undone. Could someone test in 6.4 or even previous Betas? |
Some more context here #41063 (comment) |
I tested with WP 6.4 and the same issue is not present. @dmsnell I know you have specific expertise in these types of problems and may well also be aware of changes in Core that could have caused this. Can you help shed any light on this? Also pinging @swissspidy & @dream-encode as Core Tech Leads who may be aware. |
Nothing off the top of my head. Sounds odd to store the ampersand like this in the database. Probably easiest to just do some step-by-step debugging on both 6.4 and 6.5 to find out where the difference occurs. |
👋 @scruffian brought this issue to my attention since it seems to have been caused by #59021. I'll look into it now. cc/ @tjcafferkey |
This seems like it could be related: https://core.trac.wordpress.org/ticket/60671 |
If I'm testing correctly, this problem first appeared on the backport for Beta2. Commit hash WordPress/wordpress-develop@c84cddb This problem does not seem to occur if you check out the previous commit ( |
https://developer.wordpress.org/reference/functions/wp_update_post/#parameters
|
Ohh, that looks like it could be the reason! |
Oh, I'm not sure I read that correctly. Doesn't that mean that |
https://developer.wordpress.org/reference/functions/wp_update_post/ |
Hmm, maybe |
Yeah. My current theory is that this is happening somewhere along the way between The fact that But somehow, the double backslash is then stripped: I haven't yet been able to find out where. (Edit: Backslash, not slash.) |
Hmm, looks like we have test coverage for parsing/serialization of backslashes in attribute values though: https://github.com/WordPress/wordpress-develop/blob/0f45a3c9fc10d1abf68ec9e201e6113815cdbb34/tests/phpunit/tests/blocks/serialize.php#L44-L45 (Edit: Backslashes, not slashes.) |
I'll try creating a minimal unit test for this so we can debug more easily. |
I'll have to wrap up for today; I'll continue working on it tomorrow. In the meantime, feel free to continue investigating and push commits to that PR 😊 |
This problem appears to be not limited to the Navigation Link block. At least it also happens with Search and Home Link blocks. However, it doesn't seem to occur on the Button block. 95cce3c9abab7bd69d5766f732b93ebe.mp4 |
Yeah, I suspect this is because button text is not stored in the blocks attribute values where as the other text/labels in the blocks you have mentioned are. It's the process of serializing/parsing these attributes which is where things go a bit wild. |
Thanks for asking @getdave. I had no ideas other than I wish we were done rewriting Core with the HTML API. I'm hoping to eliminate these kinds of issues, which creep up to frequently. It took me a lot of time and frustration to figure out a way to write The problem is almost certainly inside of |
Description
Adding ampersands '&' to the label field of a link (page & custom) in the Navigation block converts it to u0026, which displays on the frontend and backend once refreshed.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: