[wp-trac] [WordPress Trac] #60392: HTML API: Tag processor no longer visits all closing tags
WordPress Trac
noreply at wordpress.org
Wed Jan 31 01:31:07 UTC 2024
#60392: HTML API: Tag processor no longer visits all closing tags
--------------------------+-------------------------
Reporter: westonruter | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.5
Component: HTML API | Version: trunk
Severity: normal | Keywords: needs-patch
Focuses: |
--------------------------+-------------------------
I just discovered that the HTML Tag Processor is no longer visiting all
closing tags.
This issue was introduced in r57348 as part of #60170.
Here is a test case:
{{{#!php
<?php
<?php
$html = '
<html>
<head>
<title>Greeting</title>
</head>
<body>
<p>Hello world!</p>
</body>
</html>
';
$p = new WP_HTML_Tag_Processor( $html );
$found_closing_title_tag = false;
while ( $p->next_tag( array( 'tag_closers' => 'visit' ) ) ) {
if ( $p->is_tag_closer() && 'TITLE' === $p->get_tag() ) {
$found_closing_head_tag = true;
}
}
echo ( $found_closing_title_tag ? 'GOOD' : 'BAD' ) . PHP_EOL;
}}}
I've noticed this also happen for `STYLE` and `SCRIPT` tags in the `HEAD`,
in addition to `TITLE`.
Before the commit, this outputs `GOOD` but after the commit it outputs
`BAD`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60392>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list