WordPress.org

Make WordPress Core

Ticket #38971: disallow-empty.patch

File disallow-empty.patch, 1.5 KB (added by hnle, 4 years ago)
  • wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    508508
    509509                // Honor the discussion setting that requires a name and email address of the comment author.
    510510                if ( get_option( 'require_name_email' ) ) {
    511                         if ( ! isset( $prepared_comment['comment_author'] ) && ! isset( $prepared_comment['comment_author_email'] ) ) {
     511                        if ( empty( $prepared_comment['comment_author'] ) && empty( $prepared_comment['comment_author_email'] ) ) {
    512512                                return new WP_Error( 'rest_comment_author_data_required', __( 'Creating a comment requires valid author name and email values.' ), array( 'status' => 400 ) );
    513513                        }
    514514
    515                         if ( ! isset( $prepared_comment['comment_author'] ) ) {
     515                        if ( empty( $prepared_comment['comment_author'] ) ) {
    516516                                return new WP_Error( 'rest_comment_author_required', __( 'Creating a comment requires a valid author name.' ), array( 'status' => 400 ) );
    517517                        }
    518518
    519                         if ( ! isset( $prepared_comment['comment_author_email'] ) ) {
     519                        if ( empty( $prepared_comment['comment_author_email'] ) ) {
    520520                                return new WP_Error( 'rest_comment_author_email_required', __( 'Creating a comment requires a valid author email.' ), array( 'status' => 400 ) );
    521521                        }
    522522                }