WordPress.org

Make WordPress Core

Opened 7 weeks ago

Last modified 4 weeks ago

#47413 reviewing defect (bug)

nested paragraphs in comment post errors

Reported by: tnbnicer Owned by: jeremyfelt
Milestone: 5.3 Priority: normal
Severity: normal Version: 4.5
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

Line 30 in ‘wordpress/wp-comments-post.php’:

<?php
'<p>' . $comment->get_error_message() . '</p>'

An example of the Html code generated:

<p><p><strong>ERROR</strong>: please fill the required fields (name, email).</p></p>

The reason is that in function _default_wp_die_handler, line 3072 in ‘wordpress/wp-includes/functions.php’ (WordPress 5.2.1), there already is a paragraph tag.

<?php
$message = "<p>$message</p>"

I would suggest removing the paragraph in ‘wp-comments-post.php’. Simply:

<?php
$comment->get_error_message()

ought to do.

Attachments (1)

47413.patch (460 bytes) - added by dkarfa 7 weeks ago.
Make sense

Download all attachments as: .zip

Change History (4)

@dkarfa
7 weeks ago

Make sense

#1 @dkarfa
7 weeks ago

  • Keywords has-patch added; needs-patch removed

#2 @tnbnicer
7 weeks ago

Thanks. The fix works for me. To be honest, I removed the tags in my source in release 5.1.1 some weeks ago. I noticed them again while updating to 5.2.1 yesterday. Good.

Last edited 7 weeks ago by tnbnicer (previous) (diff)

#3 @jeremyfelt
4 weeks ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to jeremyfelt
  • Status changed from new to reviewing
  • Version changed from 5.2.1 to 4.5

Thanks @tnbnicer and @dkarfa, this looks good. I also opened #47580 to address the overall problem with invalid HTML in wp_die() output as it looks like this is something that happens in many areas of core. This particular case was introduced in [36424].

Note: See TracTickets for help on using tickets.