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.
Built from https://develop.svn.wordpress.org/trunk@47626


git-svn-id: http://core.svn.wordpress.org/trunk@47401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-04-26 13:44:07 +00:00
parent 6b5087812c
commit e55ca10ddc
2 changed files with 2 additions and 2 deletions

View File

@ -1912,7 +1912,7 @@ function wp_insert_comment( $commentdata ) {
$comment_karma = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma'];
$comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved'];
$comment_agent = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent'];
$comment_type = ! isset( $data['comment_type'] ) ? 'comment' : $data['comment_type'];
$comment_type = empty( $data['comment_type'] ) ? 'comment' : $data['comment_type'];
$comment_parent = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent'];
$user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id'];

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-47625';
$wp_version = '5.5-alpha-47626';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.