Make WordPress Core

Opened 20 years ago

Closed 19 years ago

#3669 closed defect (bug) (fixed)

Missing close </p> tag in wpautop

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

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 20 years ago.
Patch to fix this bug

Download all attachments as: .zip

Change History (10)

@scenic
20 years ago

Patch to fix this bug

#1 @scenic
20 years ago

  • Version → 2.1

#2 @charleshooper
20 years ago

  • Keywords has-patch added

#3 @stephenju
20 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
20 years ago

  • Priority low → 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
20 years ago

  • Resolution → fixed
  • Status new → closed

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

#7 @JeremyVisser
20 years ago

  • Milestone 2.1.1 → 2.2
  • Resolution fixed
  • Status closed → 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
19 years ago

Nope. Fixed. Works on r5269.

#9 @rob1n
19 years ago

  • Resolution → fixed
  • Status reopened → closed
Note: See TracTickets for help on using tickets.