Skip to content

Commit

Permalink
fix: add checks for empty IP on comment request and empty name/email …
Browse files Browse the repository at this point in the history
…if that is required, refs #500
  • Loading branch information
florianbrinkmann committed Jun 2, 2023
1 parent 2492bea commit 8349b24
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Handlers/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public static function process( $comment ) {
return self::handle_spam( $comment, [ 'asb-empty' ] );
}

if ( empty( $comment['comment_author_IP'] ) ) {
return self::handle_spam( $comment, [ 'asb-empty' ] );
}

if ( get_option( 'require_name_email' ) && ( empty( $comment['comment_author_email'] ) || empty( $comment['comment_author'] ) ) ) {
return self::handle_spam( $comment, [ 'asb-empty' ] );
}

// phpcs:disable WordPress.Security.NonceVerification.Missing
// Everybody can post.
if ( strpos( $request_path, 'wp-comments-post.php' ) === false || empty( $_POST ) ) {
Expand Down

0 comments on commit 8349b24

Please sign in to comment.