diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index d015964f0a..c96104ccfa 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -3789,7 +3789,7 @@ class wp_xmlrpc_server extends IXR_Server { } $result = wp_update_comment( $comment, true ); - if ( is_wp_error( $result ) || false === $result ) { + if ( is_wp_error( $result ) ) { return new IXR_Error( 500, $result->get_error_message() ); } diff --git a/wp-includes/comment.php b/wp-includes/comment.php index a8cc4dda29..6cc20e18c1 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -2503,9 +2503,17 @@ function wp_update_comment( $commentarr, $wp_error = false ) { */ $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr, $wp_error ); + if ( ! $data ) { + $data = new WP_Error( 'comment_update_canceled', __( 'Comment update canceled.' ) ); + } + // Do not carry on on failure. - if ( is_wp_error( $data ) || ! $data ) { - return $data; + if ( is_wp_error( $data ) ) { + if ( $wp_error ) { + return $data; + } else { + return false; + } } $keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' ); diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index 97dbb737c7..d72efedcbc 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -870,7 +870,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { $updated = wp_update_comment( wp_slash( (array) $prepared_args ), true ); - if ( is_wp_error( $updated ) || false === $updated ) { + if ( is_wp_error( $updated ) ) { return new WP_Error( 'rest_comment_failed_edit', __( 'Updating comment failed.' ), diff --git a/wp-includes/version.php b/wp-includes/version.php index edfafb4d72..821215a3e1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48217'; +$wp_version = '5.5-alpha-48218'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.