﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
7988,wpautop p (paragraph) bug with div,filosofo,,"As [http://comox.textdrive.com/pipermail/wp-hackers/2008-October/022307.html Jan Erik Moström pointed out on wp-hackers], wpautop mis-parses the following line:

{{{<div><a href=""xx""> <img src=""yy"" /> </a> <p>text</p> </div>}}}

The problem is this line in wpautop:

{{{$pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', ""<p>$1</p>$2"", $pee);}}}

This says that if a line has a {{{<p>}}} tag, some non-markup stuff, perhaps some space, followed by a closing tag of {{{</div>}}}, {{{</address>}}}, or {{{</form>}}}, then the {{{<p>}}} is orphaned and should add a closing tag ({{{</p>}}}) on the right of the non-markup stuff.

The mistake that it makes is allowing it to enclose empty space in {{{<p></p>}}}.  It makes this mistake by allowing space characters to be considered as the non-markup stuff.  My patch tells it not to do so by changing the above line to the following: 

{{{$pee = preg_replace('!<p>([^<\s]+)\s*?(</(?:div|address|form)[^>]*>)!', ""<p>$1</p>$2"", $pee);}}}

",defect (bug),closed,normal,,Formatting,2.7,normal,wontfix,has-patch needs-testing needs-unit-tests,
