Skip to content
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

Revert changes to bindings replacement logic to not use regex #62355

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

SantosGuillamot
Copy link
Contributor

@SantosGuillamot SantosGuillamot commented Jun 6, 2024

What?

Revert the changes made in this pull request to avoid using regex that can cause potential bugs like this one.

Why?

The idea of that pull request was to simplify the logic to support more attributes, but, in the end, there is no plan to support more attributes for 6.6. As it is causing other problems, it seems it is better to revert it.

How?

Just reverting the changes made.

Testing Instructions

Follow the testing instructions of #62347 (comment) and check that the issue is solved.

Copy link

github-actions bot commented Jun 6, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org>
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

github-actions bot commented Jun 6, 2024

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/compat/wordpress-6.5/blocks.php
Copy link
Member

@kevin940726 kevin940726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick PR!

Copy link

github-actions bot commented Jun 6, 2024

Flaky tests detected in 806da8a.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9396824098
📝 Reported issues:

@talldan
Copy link
Contributor

talldan commented Jun 6, 2024

but that didn't make it to 6.6 and it is causing other problems, so it seems it is better to revert it.

I see it did make it and there's a core PR WordPress/wordpress-develop#6744.

Testing with both that and this PR checked, the revert works, but with only this one the block bindings code from core still causes the issue. I guess block bindings must be running twice when the gutenberg plugin is active.

Copy link
Contributor

@talldan talldan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me too 🎉

@SantosGuillamot
Copy link
Contributor Author

SantosGuillamot commented Jun 6, 2024

I see it did make it and there's a core PR WordPress/wordpress-develop#6744.

Oh sorry, I meant that the support of more attributes didn't make it in 6.6. I'll change the description for clarity.

Testing with both that and this PR checked, the revert works, but with only this one the block bindings code from core still causes the issue.

Do you mean that with WordPress trunk and this branch you still see the issue? I will double-check, but I think it wasn't the case for me.

@talldan
Copy link
Contributor

talldan commented Jun 6, 2024

Do you mean that with WordPress trunk and this branch you still see the issue? I will double-check, but I think it wasn't the case for me.

Yep, when debugging I could see that WP_Block->replace_html is being called on the content before gutenberg_block_bindings_replace_html.

@SantosGuillamot
Copy link
Contributor Author

You're totally right. Anyway, with the backport in core I believe we should be fine.

Apart from that, I think we don't want to run gutenberg_block_bindings_replace_html if core is doing it. It should just act for older versions of WordPress. But I can work on that in another pull request.

@SantosGuillamot SantosGuillamot merged commit a5a8117 into trunk Jun 6, 2024
63 checks passed
@SantosGuillamot SantosGuillamot deleted the fix/revert-bindings-replacement-logic branch June 6, 2024 09:06
@github-actions github-actions bot added this to the Gutenberg 18.6 milestone Jun 6, 2024
patil-vipul pushed a commit to patil-vipul/gutenberg that referenced this pull request Jun 17, 2024
…ess#62355)

* Revert changes to bindings replacement logic

* Add backport changelog

Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org>
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block bindings [Type] Bug An existing feature does not function as intended
3 participants