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

Fix: Update Interactivity API Use of Private HTML API Classes to avoid Crash #56928

Merged
merged 4 commits into from
Dec 10, 2023

Conversation

dmsnell
Copy link
Member

@dmsnell dmsnell commented Dec 10, 2023

Previously the HTML API was using a mixture of approaches in its helper classes for describing spans of text. One was (start, end) and the other was (start, length). In WordPress/wordpress-develop#5721 these were all normalized to (start, length) but the Interactivity API was not updated in concert with that change.

In this patch the inner_html methods are updated to use the appropriate formats.

A following PR is necessary to update the compat layer so that crashes don't appear on sites running older versions of WordPress with this updated code.

cc: @luisherranz @ockham

What?

Why?

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

…d Crash

Previously the HTML API was using a mixture of approaches in its helper classes
for describing spans of text. One was (start, end) and the other was (start, length).
In WordPress/wordpress-develop#5721 these were all normalized to (start, length) but
the Interactivity API was not updated in concert with that change.

In this patch the `inner_html` methods are updated to use the appropriate formats.

A following PR is necessary to update the compat layer so that crashes don't appear
on sites running older versions of WordPress with this updated code.
@dmsnell dmsnell added Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Feature] Interactivity API API to add frontend interactivity to blocks. labels Dec 10, 2023
Copy link

github-actions bot commented Dec 10, 2023

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/html-api/class-gutenberg-html-attribute-token-6-5.php
❔ lib/compat/wordpress-6.5/html-api/class-gutenberg-html-span-6-5.php
❔ lib/compat/wordpress-6.5/html-api/class-gutenberg-html-tag-processor-6-5.php
❔ lib/compat/wordpress-6.5/html-api/class-gutenberg-html-text-replacement-6-5.php
❔ lib/experimental/interactivity-api/class-wp-directive-processor.php
❔ lib/load.php

Copy link

github-actions bot commented Dec 10, 2023

Flaky tests detected in 5121f03.
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/7159297188
📝 Reported issues:

@dmsnell dmsnell force-pushed the fix/interactivity-private-api-use-updates branch from 73f81be to 0e9b36f Compare December 10, 2023 16:53
@dmsnell dmsnell merged commit 5137da0 into trunk Dec 10, 2023
51 checks passed
@dmsnell dmsnell deleted the fix/interactivity-private-api-use-updates branch December 10, 2023 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core [Feature] Interactivity API API to add frontend interactivity to blocks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants