[wp-trac] [WordPress Trac] #61009: HTML API: Fix some existing bugs in `kses` comment detection, enable Bits storage.

WordPress Trac noreply at wordpress.org
Sat Jun 15 06:31:39 UTC 2024


#61009: HTML API: Fix some existing bugs in `kses` comment detection, enable Bits
storage.
-----------------------------------+------------------------------
 Reporter:  dmsnell                |       Owner:  (none)
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  HTML API               |     Version:  trunk
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------

Comment (by dmsnell):

 In [changeset:"58418" 58418]:
 {{{
 #!CommitTicketReference repository="" revision="58418"
 KSES: Preserve some additional invalid HTML comment syntaxes.

 When `wp_kses_split` processes a document it attempts to leave HTML
 comments
 alone. It makes minor adjustments, but leaves the comments in the document
 in
 its output. Unfortunately it only recognizes one kind of HTML comment and
 rejects many others.

 This patch makes a minor adjustment to the algorithm in `wp_kses_split` to
 recognize and preserve an additional kind of HTML comment: closing tags
 with
 an invalid tag name, e.g. `</%dolly>`.

 These invalid closing tags must be interpreted as comments by a browser.
 This bug fix aligns the implementation of `wp_kses_split()` more closely
 with its stated goal of leaving HTML comments as comments.

 It doesn't attempt to fully fix the mis-parsed comments, but it does
 propose a
 minor fix that hopefully won't break any existing code or projects.

 Developed in https://github.com/WordPress/wordpress-develop/pull/6395
 Discussed in https://core.trac.wordpress.org/ticket/61009

 Props ellatrix, dmsnell, joemcgill, jorbin, westonruter, zieladam.
 See #61009.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61009#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list