Support » Alpha/Beta/RC » nested paragraphs in comment post errors

  • Resolved Tom

    (@tnbnicer)


    Hi,
    This is probably wrong. Line 30 in ‘wordpress/wp-comments-post.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.

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

    I would suggest removing the paragraph in ‘wp-comments-post.php’. Simply $comment->get_error_message() ought to do.

    I hope I’m not nitpicking.

    edit: I just realized this might be the wrong forum, although perhaps the issue described can be fixed by the next release?

    • This topic was modified 1 year ago by Tom.
    • This topic was modified 1 year ago by Tom.
    • This topic was modified 1 year ago by Tom.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Joy

    (@joyously)

    Could you write a ticket? (search for existing first)
    https://core.trac.wordpress.org/

    It helps to have references directly to the code, which is easy from the Code Reference. (there are links to browse on Trac)

    https://developer.wordpress.org/reference/functions/_default_wp_die_handler/
    https://core.trac.wordpress.org/browser/tags/5.2/src/wp-comments-post.php

    Tom

    (@tnbnicer)

    https://core.trac.wordpress.org/ticket/47413#ticket

    I guess it isn’t resolved (yet) as long as the ticket is still open?

    Tom

    (@tnbnicer)

    Resolved.

    Joy

    (@joyously)

    Someone supplied a patch, but it hasn’t been reviewed or tested or built in to WordPress yet.

    Tom

    (@tnbnicer)

    An interesting question is how nested paragraphs managed to slip through the net. The earliest instance of ‘<p>’ . $comment->get_error_message() . ‘</p>’ I found occurred in 4.53. $message = “<p>$message</p>” in ‘functions.php’ has been there longer.

    I don’t know what the patch is, but what can go wrong?

    • This reply was modified 1 year ago by Tom.
    • This reply was modified 1 year ago by Tom.
    Tom

    (@tnbnicer)

    The patch is: $comment->get_error_message(),

    I believe it is safe and we’ll likely be seeing it, and no more nested tags, in the next WordPress release hopefully.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Plugin Review Team Rep

    We mark posts that have trac tickets as resolved for sanity. It lets mods and volunteers know we don’t have to jump in and find an issue. You should follow the discussion on trac. You can click the ‘Watch’ button on the trac ticket (it’s near the bottom) to get email alerts. If you need to log in, it’s the same ID/password as you use for the forums.

    Tom

    (@tnbnicer)

    I marked the post as resolved after the patch. It took about three or four hours for someone to respond and supply the patch. Anyone can check on the ticket.

    I’m glad everything works.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Plugin Review Team Rep

    Yeah that was because Joy pointed out the ticket wasn’t closed yet. You did the right thing, Tom!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘nested paragraphs in comment post errors’ is closed to new replies.