[wp-trac] [WordPress Trac] #36445: force_balance_tags nor properly balancing custom HTML tags with dashes in them
WordPress Trac
noreply at wordpress.org
Thu Apr 7 22:33:44 UTC 2016
#36445: force_balance_tags nor properly balancing custom HTML tags with dashes in
them
--------------------------+-----------------------------
Reporter: toddhuish | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 4.4.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Given the following HTML and having "settings...writing..WordPress should
correct invalidly nested XHTML automatically" checked, upon save
This
{{{
<amp-ad>
type="fmpub"
</amp-ad>
}}}
results in
{{{
<amp -ad>
type="fmpub"
</amp>
}}}
I found this problem while customizing an AMP enabled installation. AMP
ads use amp-ad or amp-embed tags, both of which get munged by balance
tags. I have attached a proposed fix for this problem but I am not sure
what the overall implications are of this change.
{{{
--- formatting.php 2016-04-07 15:29:18.000000000 -0700
+++ formatting-fixed.php 2016-04-07 15:29:52.000000000 -0700
@@ -1800,7 +1800,7 @@
// WP bug fix for LOVE <3 (and other situations with '<' before a
number)
$text = preg_replace('#<([0-9]{1})#', '<$1', $text);
- while ( preg_match("/<(\/?[\w:]*)\s*([^>]*)>/", $text, $regex) ) {
+ while ( preg_match("/<(\/?[\w:-]*)\s*([^>]*)>/", $text, $regex) )
{
$newtext .= $tagqueue;
$i = strpos($text, $regex[0]);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36445>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list