Make WordPress Core

Opened 3 weeks ago

Last modified 12 days ago

#62085 new enhancement

HTML API: Stop counting no-op seek operations against the quota.

Reported by: dmsnell's profile dmsnell Owned by:
Milestone: 6.8 Priority: normal
Severity: normal Version: trunk
Component: HTML API Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

The HTML Tag Processor limits how many times seek() may be called. This is in place to guard against accidental infinite loops introduced by code which might bounce between bookmarks in an unintentional cycle.

Some code might call seek() on a bookmark where the internal cursor already is. Since a seek to the current locations involves essentially no processing, and is less likely to be the result of an unseen cycle, the HTML Tag Processor should ignore these calls against the quota.

Change History (4)

#1 @dmsnell
3 weeks ago

After proposing this, I'm now wondering if it's wrong to open up the quote because I think it's also similarly likely that an accidental infinite loop could involve no-op seeks. Perhaps we want a different getter to report if the processor has moved from a bookmark?

<?php
if ( ! $processor->is_at_bookmark( 'here' ) ) {
        $processor->seek( 'here' );
}

cc: @westonruter @jonsurrell

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


3 weeks ago
#2

  • Keywords has-patch has-unit-tests added

Trac ticket: Core-62085

#3 @westonruter
2 weeks ago

I don't know. It seems like this may be doing too much to attempt to prevent a developer from committing a basic logic error in their code.

#4 @davidbaumwald
12 days ago

  • Milestone changed from 6.7 to 6.8

With 6.7 Beta 1 releasing in a few hours, this is being moved to 6.8 given recent momentum towards a resolution.

Note: See TracTickets for help on using tickets.