Make WordPress Core

Opened 4 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#61581 closed defect (bug) (fixed)

HTML Processor should respect `tag_name` argument in `next_tag()`

Reported by: dmsnell's profile dmsnell Owned by: dmsnell's profile dmsnell
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.4
Component: HTML API Keywords: has-patch needs-dev-note
Focuses: Cc:

Description

The HTML Processor currently ignores the tag_name provided if provided in its array form.

<?php
$processor->next_tag( array( 'tag_name' => 'DIV' ) );

It returns the next tag regardless of its name. It should instead continue scanning until it finds a tag of the given name or reaches the end of the document.

Change History (5)

#1 @dmsnell
4 weeks ago

  • Keywords has-patch added

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


4 weeks ago
#2

Trac ticket: Core-61581

Previously the HTML Processor was ignoring the tag_name argument in the next_tag() query if it existed. This was wrong adn would lead to calling code finding the very next tag, regardless of tag name, instead of the requested taag.

This patch adds the tag name detection code into next_tag() to fix the bug and ensure that next_tag() always returns only when finding a tag of the given name.

Follow-up to [56274].

#3 @dmsnell
4 weeks ago

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

In 58681:

HTML API: Respect tag_name query arg in HTML_Processor::next_tag()

Previously the HTML Processor was ignoring the tag_name argument in
the next_tag() query if it existed. This was wrong adn would lead to
calling code finding the very next tag, regardless of tag name, instead
of the requested taag.

This patch adds the tag name detection code into next_tag() to fix
the bug and ensure that next_tag() always returns only when finding
a tag of the given name.

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

Follow-up to [56274].

Fixes #61581.

#5 @dmsnell
4 weeks ago

  • Keywords needs-dev-note added
Note: See TracTickets for help on using tickets.