Make WordPress Core

Opened 2 months ago

#63997 new defect (bug)

wptexturize incorrectly escapes attribute quotes after encountering greater-than sign

Reported by: icmcnamara's profile icmcnamara Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.8.2
Component: Formatting Keywords:
Focuses: Cc:

Description

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 %>&#8221; data-label=&#8221;{A &#8216;message&#8217; string}&#8221;>Content</div>
// Expected output:
//    <div data-template="Label <% value %>"; data-label="{A &#8216;message&#8217; 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&#8243; data-broken=&#8221;b&#8221; data-fixer=&#8221;<" data-working="1">Content</div>

Change History (0)

Note: See TracTickets for help on using tickets.