Opened 10 years ago
Closed 7 years ago
#36445 closed defect (bug) (duplicate)
force_balance_tags not properly balancing custom HTML tags with dashes in them
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.4.2 |
| Component: | Formatting | Keywords: | has-patch |
| Focuses: | Cc: |
Description
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]);
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Proposed patch with preg_match change