[wp-trac] [WordPress Trac] #2691: HTML comments in posts aren't handled properly.
WordPress Trac
noreply at wordpress.org
Thu Jul 4 04:20:56 UTC 2019
#2691: HTML comments in posts aren't handled properly.
-------------------------------------------------+-------------------------
Reporter: gord | Owner:
| adamsilverstein
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.3
Component: Formatting | Version: 2.8.5
Severity: normal | Resolution:
Keywords: wpautop dev-feedback has-patch has- | Focuses:
unit-tests |
-------------------------------------------------+-------------------------
Comment (by pento):
Also, this regex is possibly wrong.
{{{#!php
$pee = preg_replace( "|(\-\->.*[^</p>])\n|", "$1<br />\n", $pee );
}}}
I think it's intended to match everything that isn't a `</p>` tag, until
it reaches a `\n`? It will actually match everything that isn't one of the
characters `<`, `/`, `p`, or `>`, followed by a `\n`.
Given that this is a fairly simple check, I think it'd be better to do it
in the `$pees` loop, instead. If a `$tinkle` starts and ends with HTML
comment syntax, don't wrap it in `<p>` tags.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/2691#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list