Make WordPress Core

Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#64485 closed defect (bug) (fixed)

WP_Block_Processor should indicate that inner HTML matches no block type.

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

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.


9 months 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
9 months ago

  • Resolution → fixed
  • Status assigned → 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
9 months ago

  • Keywords dev-feedback added
  • Resolution fixed
  • Status closed → reopened

Re-opening for review for backport into 6.9.1 branch.

#4 @sabernhardt
9 months ago

  • Keywords fixed-major added

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


9 months ago

#6 @jorbin
9 months 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
9 months ago

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

#8 @jonsurrell
9 months ago

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

#9 @jonsurrell
9 months ago

  • Keywords dev-feedback removed

[61452] looks good to backport to 6.9.

#10 @jorbin
9 months 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.


9 months 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
9 months 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
9 months ago

  • Resolution → fixed
  • Status reopened → 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
9 months ago

thanks doubly @jonsurrell and @wildworks!

Note: See TracTickets for help on using tickets.