Ticket #3669 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Missing close </p> tag in wpautop

Reported by: scenic Assigned to: 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 (0.8 kB) - added by scenic on 01/25/07 05:49:14.
Patch to fix this bug

Change History

01/25/07 05:49:14 changed by scenic

  • attachment ptag-formatting.patch added.

Patch to fix this bug

01/25/07 06:26:55 changed by scenic

  • version set to 2.1.

01/29/07 09:16:29 changed by charleshooper

  • keywords changed from wpautop xhtml to wpautop xhtml has-patch.

02/01/07 20:53:17 changed by stephenju

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?

02/02/07 20:23:53 changed by stephenju

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

02/20/07 04:43:47 changed by ryan

02/20/07 05:41:42 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

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

04/01/07 05:26:11 changed by JeremyVisser

  • status changed from closed to reopened.
  • resolution 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).

04/14/07 05:41:32 changed by rob1n

Nope. Fixed. Works on r5269.

04/14/07 05:42:50 changed by rob1n

  • status changed from reopened to closed.
  • resolution set to fixed.