Ticket #3669 (closed defect (bug): fixed)

Opened 5 years ago

Last modified 5 years ago

Missing close </p> tag in wpautop

Reported by: scenic Owned by: anonymous
Priority: high Milestone: 2.2
Component: Template Version: 2.1
Severity: normal Keywords: wpautop xhtml has-patch
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

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

Change History

scenic5 years ago

Patch to fix this bug

  • Version set to 2.1
  • Keywords has-patch added

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?

  • 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.

comment:6   ryan5 years ago

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

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

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

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).

Nope. Fixed. Works on r5269.

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