[wp-trac] [WordPress Trac] #27350: Invalid HTML Output
WordPress Trac
noreply at wordpress.org
Sat Mar 22 00:27:53 UTC 2014
#27350: Invalid HTML Output
--------------------------+------------------------------
Reporter: miqrogroove | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version: 3.8
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by bcworkz):
Yes, it is `wpautop()` wreaking havoc. FWIW, one way to prevent it is to
switch to the visual tab, which inserts a huge amount of white space. The
extra white space, while being offensive to those that hand code HTML,
does allow `wpautop()` to work correctly.
I've traced the problem to the block of code starting at line 265 of wp-
includes/formatting.php. The block starting with:
{{{
$pee = preg_replace('|<p>\s*</p>|', '', $pee); // under certain strange
conditions it could create a P of entirely whitespace
}}}
I've no idea how to correct for the errors though without potentially
messing up other HTML.
The function essentially adds opening and closing P tags at the front and
end of every line, then removes those tags not adjacent to multiple
newlines. However, there's a slew of regexp replacements to account for
special situations which makes the whole thing very complex and prone to
unanticipated errors like you've found..
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27350#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list