Make WordPress Core

Opened 2 years ago

Last modified 3 weeks ago

#38656 reopened defect (bug)

wpautop incorrectly handling paragraphs within block elements

Reported by: pento Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Formatting Keywords: has-patch, needs-unit-tests, needs-testing, bulk-reopened
Focuses: Cc:


When there are two line breaks within a block element, wpautop() will replace it with </p><p>, but the corresponding opening and closing tags won't exist.

For example, <div>a\n\nb</div> will produce <div>a</p><p>b</div>, when it really should produce <div>\n<p>a</p>\n<p>b</p>\n</div>.

Attachments (3)

38656.diff (3.8 KB) - added by pento 2 years ago.
38656.2.diff (5.6 KB) - added by pento 2 years ago.
38656.3.diff (6.8 KB) - added by pento 2 years ago.

Download all attachments as: .zip

Change History (8)

2 years ago

#1 @pento
2 years ago

38656.diff is a first pass at fixing this, it needs many more unit tests.

2 years ago

#2 @pento
2 years ago

38656.2.diff makes this all work with nested peeable and unpeeable elements, and adds more unit tests.

2 years ago

#3 @pento
2 years ago

38656.3.diff adds code comments, and some more complex tests.

There's probably value in adding some intelligence to the closing HTML tag detection, so we can handle some basic invalid HTML. For example, a browser will automatically correct <div><span>foo</div>, and treat it as <div><span>foo</span></div>, but wpautop() will get $peeable out of sync, causing problems.

#4 @iseulde
3 months ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#5 @JeffPaul
3 weeks ago

  • Keywords bulk-reopened added
  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

A decision was made to reopen tickets that were closed in the bulk edit that this ticket was affected by. This ticket is being placed back into the Awaiting Review milestone so it can be individually evaluated and verified to determine if it is still relevant/valid or reproducible.

Note: See TracTickets for help on using tickets.