[wp-trac] [WordPress Trac] #60191: Ampersand in non-entities such as &a; is not escaped

WordPress Trac noreply at wordpress.org
Tue Feb 20 10:55:10 UTC 2024


#60191: Ampersand in non-entities such as &a; is not escaped
---------------------------+------------------------------
 Reporter:  superpoincare  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Formatting     |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by judyeland):

 To address the issue of improperly escaping ampersands in non-entities,
 such as &a;, in WordPress, you can implement a solution by checking if the
 pattern matched is a valid HTML entity. Use **html_entity_decode** to
 decode the entity and compare it with the original string. If they differ,
 it's a valid entity, and the ampersand should not be escaped. Update the
 relevant code in WordPress to include this additional check. The block
 editor already has a mechanism to prevent such issues, but older posts and
 plugin-generated content may need this fix.

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


More information about the wp-trac mailing list