Make WordPress Core


Ignore:
Timestamp:
04/26/2020 01:42:03 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Comments: Ensure that inserting a comment with an empty type results in correct comment type.

Add unit tests for wp_handle_comment_submission() and wp_insert_comment() receiving an empty type.

Follow-up to [47597].

Props ocean90, imath.
Fixes #49236.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r47617 r47626  
    19131913    $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved'];
    19141914    $comment_agent    = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent'];
    1915     $comment_type     = ! isset( $data['comment_type'] ) ? 'comment' : $data['comment_type'];
     1915    $comment_type     = empty( $data['comment_type'] ) ? 'comment' : $data['comment_type'];
    19161916    $comment_parent   = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent'];
    19171917
Note: See TracChangeset for help on using the changeset viewer.