Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#3669 closed defect (bug) (fixed)

Missing close </p> tag in wpautop

Reported by: scenic's profile scenic Owned by:
Milestone: 2.2 Priority: high
Severity: normal Version: 2.1
Component: Template Keywords: wpautop xhtml has-patch
Focuses: Cc:

Description

wpautop seems to change <p><div></div></p> to <div><p></div>
(note the lack of a closing </p> in the second). This broke XHTML
compliance in some text appended by a custom plugin of mine, but I'm
guessing it would affect any div's I put in via the edit page.

I've attached the patch, but the short version of the fix is adding
this line below after line 66 in wp-includes/formatting.php.

$pee = preg_replace( '|(</div[>]*>\s*)</p>|', "</p>$1", $pee );

Attachments (1)

ptag-formatting.patch (820 bytes) - added by scenic 18 years ago.
Patch to fix this bug

Download all attachments as: .zip

Change History (10)

@scenic
18 years ago

Patch to fix this bug

#1 @scenic
18 years ago

  • Version set to 2.1

#2 @charleshooper
18 years ago

  • Keywords has-patch added

#3 @stephenju
18 years ago

The problem was introduced in this [4565] which was intended to fix #2647. But the patch in #2647 doesn't contain lines 66 to 68 in [4565]. Where were those lines from?

#4 @stephenju
18 years ago

  • Priority changed from low to high

This is cause plugins that generate <div> tags to fail. WPG2 is the prime example.

Could someone please explain what the extra lines (66-68) in [4565] do? I suggest backing that 3 lines out to fix this problem.

#6 @ryan
18 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4894]) Don't insert p inside of div. fixes #3669

#7 @JeremyVisser
18 years ago

  • Milestone changed from 2.1.1 to 2.2
  • Resolution fixed deleted
  • Status changed from closed to reopened

I can still reproduce this bug. Running WordPress MU 1.2.1 (the wpautop() function is currently exactly the same as in trunk with your fix).

#8 @rob1n
18 years ago

Nope. Fixed. Works on r5269.

#9 @rob1n
18 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.