Make WordPress Core

Changeset 59975


Ignore:
Timestamp:
03/11/2025 09:56:24 PM (2 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp_check_comment_data().

Follow-up to [2894], [28437], [59319].

Props aristath, poena, afercia, SergeyBiryukov.
See #62279.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r59957 r59975  
    12881288    if ( ! empty( $comment_data['user_id'] ) ) {
    12891289        $user        = get_userdata( $comment_data['user_id'] );
    1290         $post_author = $wpdb->get_var(
     1290        $post_author = (int) $wpdb->get_var(
    12911291            $wpdb->prepare(
    12921292                "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1",
     
    12961296    }
    12971297
    1298     if ( isset( $user ) && ( $comment_data['user_id'] == $post_author || $user->has_cap( 'moderate_comments' ) ) ) {
     1298    if ( isset( $user ) && ( $comment_data['user_id'] === $post_author || $user->has_cap( 'moderate_comments' ) ) ) {
    12991299        // The author and the admins get respect.
    13001300        $approved = 1;
Note: See TracChangeset for help on using the changeset viewer.