[wp-trac] [WordPress Trac] #18575: wptexturize modified code inside tag attributes
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 2 22:36:25 UTC 2011
#18575: wptexturize modified code inside tag attributes
--------------------------+-----------------------------
Reporter: iamcal | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 3.3
Severity: normal | Keywords:
--------------------------+-----------------------------
In certain circumstances, wptexturize() will try to smart quote things
inside attributes, screwing up the markup. For example:
{{{
[hello <a href="foo[bar]('baz')">world</a>
}}}
The tokenizer that generates $textarr will split the text like this:
{{{
0: [hello <a href="foo[bar]
1:('baz')">world
2:</a>
}}}
and so element 1 gets treated like non-tag text even though it's from an
attribute. the easy fix is to not allow starting braces inside a brace
set:
old:
{{{
$textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1,
PREG_SPLIT_DELIM_CAPTURE);
}}}
new:
{{{
$textarr = preg_split('/(<[^<]*>|\[[^\[]*\])/Us', $text, -1,
PREG_SPLIT_DELIM_CAPTURE);
}}}
this happens on trunk. code is in wp-includes/formatting.php. after the
patch, the tokenizer works as intended:
{{{
0: [hello
1: <a href="foo[bar]('baz')">
2: world
3: </a>
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18575>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list