From 7475126055ddf7b9fd6c303d2468676926b762f0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 11 Mar 2025 21:56:24 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp_check_comment_data()`. Follow-up to [2894], [28437], [59319]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. git-svn-id: https://develop.svn.wordpress.org/trunk@59975 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index 8d05be9063..20c219cd27 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -1287,7 +1287,7 @@ function wp_check_comment_data( $comment_data ) { if ( ! empty( $comment_data['user_id'] ) ) { $user = get_userdata( $comment_data['user_id'] ); - $post_author = $wpdb->get_var( + $post_author = (int) $wpdb->get_var( $wpdb->prepare( "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_data['comment_post_ID'] @@ -1295,7 +1295,7 @@ function wp_check_comment_data( $comment_data ) { ); } - if ( isset( $user ) && ( $comment_data['user_id'] == $post_author || $user->has_cap( 'moderate_comments' ) ) ) { + if ( isset( $user ) && ( $comment_data['user_id'] === $post_author || $user->has_cap( 'moderate_comments' ) ) ) { // The author and the admins get respect. $approved = 1; } else {