HTML API: Fix a case where updates are overlooked when seeking to earlier locations.

This retains the WP_HTML_Tag_Processor attribute updates applied before calling seek() – they were erroneously erased in some cases.

Props dmsnell.
Fixes #58160.





git-svn-id: https://develop.svn.wordpress.org/trunk@55675 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
zieladam
2023-04-21 13:30:11 +00:00
parent fea66becf5
commit 87154ab87d
2 changed files with 22 additions and 0 deletions

View File

@@ -2142,6 +2142,8 @@ class WP_HTML_Tag_Processor {
* to the end of the updated document and return.
*/
if ( $requires_no_updating && $this->bytes_already_copied > 0 ) {
$this->html = $this->output_buffer . substr( $this->html, $this->bytes_already_copied );
$this->bytes_already_copied = strlen( $this->output_buffer );
return $this->output_buffer . substr( $this->html, $this->bytes_already_copied );
}