Make WordPress Core

Changeset 34545


Ignore:
Timestamp:
09/25/2015 02:42:48 PM (9 years ago)
Author:
boonebgorges
Message:

Improve status checks when sending comment post author notification.

[34537] hooked wp_new_comment_notify_postauthor() to the
'wp_set_comment_status' when a comment had been approved. When performing
multiple actions on a comment in the same request (as happens in
Tests_Ajax_DeleteComment::test_ajax_trash_double_action(), and may happen
sometimes in real life too), and when one of those actions involves deleting
the comment, the $comment_ID passed to wp_new_comment_notify_postauthor()
can correspond to an already-deleted comment. The comment_status check should
account for this possibility.

See #14078.

File:
1 edited

Legend:

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

    r34537 r34545  
    17381738
    17391739    // Only send notifications for approved comments.
    1740     if ( 'spam' === $comment->comment_approved || ! $comment->comment_approved ) {
     1740    if ( ! isset( $comment->comment_approved ) || 'spam' === $comment->comment_approved || ! $comment->comment_approved ) {
    17411741        return false;
    17421742    }
Note: See TracChangeset for help on using the changeset viewer.