Make WordPress Core

Opened 8 months ago

Closed 3 months ago

Last modified 3 months ago

#62085 closed enhancement (fixed)

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

Reported by: dmsnell's profile dmsnell Owned by: westonruter's profile westonruter
Milestone: 6.8 Priority: normal
Severity: normal Version: 6.7
Component: HTML API Keywords: has-patch has-unit-tests commit
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 (12)

#1 @dmsnell
8 months 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.


8 months ago
#2

  • Keywords has-patch has-unit-tests added

Trac ticket: Core-62085

#3 @westonruter
8 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
7 months 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.

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


3 months ago

#6 @audrasjb
3 months ago

  • Milestone changed from 6.8 to Future 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
3 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
3 months ago

  • Keywords commit added
  • Owner set to westonruter
  • Status changed from new to accepted

I move to commit this.

#10 @westonruter
3 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

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:


3 months ago
#11

Committed in r59812.

#12 @westonruter
3 months ago

  • Milestone changed from Future Release to 6.8
Note: See TracTickets for help on using tickets.