[wp-trac] [WordPress Trac] #63997: wptexturize incorrectly escapes attribute quotes after encountering greater-than sign

WordPress Trac noreply at wordpress.org
Thu Sep 18 00:25:53 UTC 2025


#63997: wptexturize incorrectly escapes attribute quotes after encountering
greater-than sign
--------------------------+-----------------------------
 Reporter:  icmcnamara    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Formatting    |    Version:  6.8.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 This appears to be a more generalized version of ticket
 https://core.trac.wordpress.org/ticket/63426.

 The following examples could be run on the the 'init' action hook.

 Using the greater-than character within attribute values causes the
 wptexturize function to incorrectly convert all proceeding quotation marks
 to decimal code.

 {{{
 <?php
 $div_string = '<div data-template="Label <% value %>" data-label="{A
 \'message\' string}">Content</div>'
 echo wptexturize( $div_string );
 // Output:
 //    <div data-template="Label <% value %>” data-label=”{A
 ‘message’ string}”>Content</div>
 // Expected output:
 //    <div data-template="Label <% value %>"; data-label="{A
 ‘message’ string}">Content</div>
 }}}

 This attribute quote escaping "resets" when a less-than symbol is
 encountered.

 {{{
 $div_string = '<div data-break="3>2" data-broken="b" data-fixer="<" data-
 working="1">Content</div>';
 echo wptexturize( $div_string );
 // Output:
 //    <div data-break="3>2″ data-broken=”b” data-
 fixer=”<" data-working="1">Content</div>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63997>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list