Make WordPress Core

Opened 5 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#64485 closed defect (bug) (fixed)

WP_Block_Processor should indicate that inner HTML matches no block type.

Reported by: dmsnell's profile dmsnell Owned by: dmsnell's profile dmsnell
Milestone: 6.9.1 Priority: normal
Severity: normal Version: 6.9
Component: Editor Keywords: has-patch fixed-major dev-reviewed has-unit-tests
Focuses: Cc:

Description

When the Block Processor was introduced there was a latent bug in the is_block_type() method. It misreports the block types when inner HTML is involved, as it was written before the concepts of inner HTML and top-level freeform content were separated.

It should only report block type matches for actual block delimiters and for top-level freeform content.

Change History (14)

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


5 weeks ago
#1

  • Keywords has-patch added

Trac ticket: Core-64485

## Status

  • [ ] Add unit tests exposing the bug and demonstrating the fix.

## Summary

Previously, the WP_Block_Processor class was making a mistake in mis-reporting whether a token matches a block type when #innerHTML spans are involved.

This patch fixes the logic, which was originally written before a distinction between inner HTML and top-level freeform content was built.

#2 @dmsnell
5 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 61452:

Block Processor: Fix is_block_type() for inner HTML

Previously, the WP_Block_Processor class was making a mistake in
mis-reporting whether a token matches a block type when #innerHTML spans
are involved.

This patch fixes the logic, which was originally written before a
distinction between inner HTML and top-level freeform content was built.

Developed in https://github.com/WordPress/wordpress-develop/pull/10701
Discussed in https://core.trac.wordpress.org/ticket/64485

Fixes #64485.

#3 @dmsnell
5 weeks ago

  • Keywords dev-feedback added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Re-opening for review for backport into 6.9.1 branch.

#4 @sabernhardt
5 weeks ago

  • Keywords fixed-major added

This ticket was mentioned in Slack in #core by jorbin. View the logs.


4 weeks ago

#6 @jorbin
4 weeks ago

@jonsurrell @westonruter since both of you worked on the original ticket (#61401) for the Block Processor, would you be able to review this for backport?

#7 @westonruter
4 weeks ago

I will defer to Jon since he's much more familiar with this code.

#8 @jonsurrell
4 weeks ago

I'm in touch with @dmsnell and we'll get this sorted for 6.9.1.

#9 @jonsurrell
4 weeks ago

  • Keywords dev-feedback removed

[61452] looks good to backport to 6.9.

#10 @jorbin
3 weeks ago

  • Keywords dev-reviewed added

Adding dev-reviewed based on @jonsurrell's last comment.

Minor, but I do think a PR could be helpful to ensure that tests pass on php7.2 & 7.3 since those aren't being run by trunk

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


3 weeks ago
#11

  • Keywords has-unit-tests added

# This is a backport testing PR for [61452].

Previously, the WP_Block_Processor class was making a mistake in mis-reporting whether a token matches a block type when #innerHTML spans are involved.

This patch fixes the logic, which was originally written before a distinction between inner HTML and top-level freeform content was built.

Developed in https://github.com/WordPress/wordpress-develop/pull/10701.
Discussed in https://core.trac.wordpress.org/ticket/64485.

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

#12 @wildworks
3 weeks ago

@dmsnell @jonsurrell Do you have the bandwidth to commit the changes to the 6.9 branch? The backport tests seem to work fine.

#13 @jonsurrell
3 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 61528:

Block Processor: Fix is_block_type() for inner HTML

Previously, the WP_Block_Processor class was making a mistake in mis-reporting whether a token matches a block type when #innerHTML spans are involved.

This patch fixes the logic, which was originally written before a distinction between inner HTML and top-level freeform content was built.

Developed in https://github.com/WordPress/wordpress-develop/pull/10701
Discussed in https://core.trac.wordpress.org/ticket/64485

Reviewed by jonsurrell.
Merges [61452] to the 6.9 branch.

Props dmsnell.
Fixes #64485.

#14 @dmsnell
3 weeks ago

thanks doubly @jonsurrell and @wildworks!

Note: See TracTickets for help on using tickets.