Make WordPress Core

Opened 13 years ago

Closed 5 years ago

#18136 closed defect (bug) (duplicate)

WordPress Adding Spurious </p>

Reported by: singpolyma's profile singpolyma Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Formatting Keywords: wpautop has-patch needs-refresh
Focuses: Cc:

Description

If you look at this page: https://singpolyma.net/2011/06/dystoparx-part-12/ WordPress seems to be adding extra </p> tags before the </div>s This causes major well-formedness problems on the page.

Attachments (2)

Autop-18136.diff (604 bytes) - added by jond 10 years ago.
Autop.php unit test coverage for #18136
Autop-18136-fixed.diff (605 bytes) - added by jond 10 years ago.
Fixed expected results

Download all attachments as: .zip

Change History (25)

#1 @nacin
13 years ago

Please post the HTML you have in your post content. We need before and after.

#2 @nacin
13 years ago

  • Keywords reporter-feedback added

#3 @ipublicis
12 years ago

I checked the code on some of the other more recent posts and it doesn't show anymore. This has more than one year. Shouldn't it be closed?

#4 @SergeyBiryukov
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Severity changed from major to normal
  • Status changed from new to closed

There are still excess </p> tags in the linked post, but I couldn't reproduce the issue by copying the content from the HTML source (also tried switching to visual editor and back to HTML) neither in 3.4 nor in current trunk.

Free free to reopen with steps to reproduce if there's still a problem.

#5 @singpolyma
12 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

http://pastie.org/4466275

That's the input as showing on my WP dashboard. I tried saving again and with X-Valid turned off as well, just in case that was transforming it (but it's not, still shows as fine in the dashboard), but it's still got the extra </p> in the page.

#6 @singpolyma
12 years ago

  • Keywords reporter-feedback removed

#7 @SergeyBiryukov
12 years ago

  • Milestone set to Awaiting Review

Confirmed when pasting the linked input into HTML (Text in 3.5) editor, saving and viewing the post.

After switching to visual editor and back, the extra </p> is gone.

#8 @singpolyma
12 years ago

I enabled the visual editor, switched to it and then switched back, and it broke some of my other markup, but after fixing that it does seem to be a workaround for the issue.

Still seems like a bug, though.

#9 @azaozz
12 years ago

Got it down to this:

  • Extra closing P
    <div><p>123</p> </div> 
    
  • Works as expected
    <div><p>123</p></div> 
    

Generally autop should ignore the whole content as there are no line breaks in there. What happens in this case: autop inserts a line break after the </p> and then threats the white space as another row.

A temporary workaround would be to remove all spaces between block tags.

#11 @Japh
11 years ago

  • Cc japh@… added

#12 @mbijon
11 years ago

  • Cc mike@… added

Related: #21689
(via @Japh)

#13 @nacin
10 years ago

  • Keywords wpautop added

#14 @nacin
10 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.


10 years ago

@jond
10 years ago

Autop.php unit test coverage for #18136

#16 @jond
10 years ago

Added test coverage based on @azaozz findings.

@jond
10 years ago

Fixed expected results

#17 @MikeHansenMe
9 years ago

  • Keywords needs-patch added; needs-unit-tests removed

Looks like this still needs a patch but already has unit tests.

#18 @jond
9 years ago

@MikeHansenMe See the patch applied to #27350. The fix for #27350 also fixes #18136 and passes unit tests.

#19 @jond
9 years ago

  • Keywords has-patch added; needs-patch removed

#20 @chriscct7
8 years ago

  • Keywords needs-refresh added

#22 @dionysous
6 years ago

Because we are encountering the same problem, I added a comment in #18136, when this is happening on our websites. Since this produces invalid HTML in the frontend, we get many reports about this.

Version 0, edited 6 years ago by dionysous (next)

#23 @pento
5 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

Closing this as a duplicate of #27350, which has the same root cause.

Note: See TracTickets for help on using tickets.