Make WordPress Core

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#59643 closed defect (bug) (fixed)

HTML API: Scan to end of tag when getting updated HTML output.

Reported by: dmsnell's profile dmsnell Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.4 Priority: normal
Severity: major Version: 6.4
Component: HTML API Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Fixes a bug introduced in #59607.

When applying updates to HTML, one step was left out in #59607 which updated the position of the end of the current tag. This made it possible to create bookmarks with null or earlier end positions than their start position. This in turn broke the Directive Processor in Gutenberg during the backport of changes from Core into Gutenberg.

In this patch, after applying updates, the HTML document is now scanned fully to the end of the current tag, updating the internal pointer to its end, so that nothing else will be broken or misaligned.\

---

Given that the bug introduced in #59607 has unknown impact, I strongly urge that we incorporate this patch into 6.4 if it's still possible. The fix should be complete and the reason for this confidence is that it was an obvious-in-hindsight mistake to not find the end of the existing tag when applying updates. Everything except this was called from the change that called the internals directly. Adding the missing piece should close up the erroneous cases.

Change History (8)

This ticket was mentioned in Slack in #core-editor by dmsnell. View the logs.


14 months ago

#2 @dmsnell
14 months ago

Last edited 14 months ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
14 months ago

  • Description modified (diff)
  • Milestone changed from Awaiting Review to 6.4

This ticket was mentioned in PR #5506 on WordPress/wordpress-develop by @dmsnell.


14 months ago
#4

Trac ticket: https://core.trac.wordpress.org/ticket/59643

Fixes a bug introduced in #5475.

When applying updates to HTML, one step was left out in #5475 which updated the position of the end of the current tag. This made it possible to create bookmarks with null or earlier end positions than their start position. This in turn broke the Directive Processor in Gutenberg during the backport of changes from Core into Gutenberg.

In this patch, after applying updates, the HTML document is now scanned fully to the end of the current tag, updating the internal pointer to its end, so that nothing else will be broken or misaligned.

cc: @ramonjd @andrewserong

#5 @SergeyBiryukov
14 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 56953:

HTML API: Scan to end of tag when getting updated HTML output.

When applying updates to HTML, one step was left out in [56941] which updated the position of the end of the current tag. This made it possible to create bookmarks with null or earlier end positions than their start position. This in turn broke the Directive Processor in Gutenberg during the backport of changes from Core into Gutenberg.

In this commit, after applying updates, the HTML document is now scanned fully to the end of the current tag, updating the internal pointer to its end, so that nothing else will be broken or misaligned.

Follow-up to [56941].

Props dmsnell.
Fixes #59643.

@SergeyBiryukov commented on PR #5506:


14 months ago
#6

Thanks for the PR! Merged in r56953.

@dmsnell commented on PR #5506:


14 months ago
#7

Thank you @SergeyBiryukov for picking this up and moving it forward.

#8 @dmsnell
14 months ago

Backport into Gutenberg to finalize this is in Gutenberg#55703.

Took me a bit longer than I expected because I had some questions about the backport as it relates to 6.4 finishing up, but it seems like things are clear now.

Note: See TracTickets for help on using tickets.