From d857f68a2542f0183680139d95d474e3b413d157 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 11 Mar 2025 21:58: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. Built from https://develop.svn.wordpress.org/trunk@59975 git-svn-id: http://core.svn.wordpress.org/trunk@59317 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 8d05be9063..20c219cd27 100644 --- a/wp-includes/comment.php +++ b/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 { diff --git a/wp-includes/version.php b/wp-includes/version.php index 45314d57a8..33dba49d35 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-beta2-59973'; +$wp_version = '6.8-beta2-59975'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.