Make WordPress Core

Opened 2 years ago

Closed 18 months ago

Last modified 18 months ago

#62085 closed enhancement (fixed)

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

Reported by: dmsnell Owned by: westonruter
Priority: normal Milestone: 6.8
Component: HTML API Version: 6.7
Severity: normal Keywords: has-patch has-unit-tests commit
Cc: Focuses:

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 (12)

#1 @dmsnell
2 years 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.


2 years ago
#2

  • Keywords has-patch has-unit-tests added

Trac ticket: Core-62085

#3 @westonruter
23 months 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
23 months ago

  • Milestone 6.76.8

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

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


18 months ago

#6 @audrasjb
18 months ago

  • Milestone 6.8Future Release

As per today's bug scrub:
Hello @dmsnell @westonruter, how can we move this towards a resolution? Or should we close it as wontfix/maybelater for now?
Moving to Future Release pending a decision.

#8 @westonruter
18 months ago

I can confirm that with the patch applied that I can remove all cursor move counting that I had to do in Optimization Detective: https://github.com/WordPress/performance/pull/1861

#9 @westonruter
18 months ago

  • Keywords commit added
  • Owner set to westonruter
  • Status newaccepted

I move to commit this.

#10 @westonruter
18 months ago

  • Resolutionfixed
  • Status acceptedclosed

In 59812:

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

This allows seek() to be freely called when the current cursor at the provided bookmark.

Props dmsnell, jonsurrell, westonruter.
Fixes #62085.

@westonruter commented on PR #7399:


18 months ago
#11

Committed in r59812.

#12 @westonruter
18 months ago

  • Milestone Future Release6.8
Note: See TracTickets for help on using tickets.