From 4c18ad595e50b585cb4145c629ad2849e32449ae Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 25 Sep 2015 14:43:24 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@34545 git-svn-id: http://core.svn.wordpress.org/trunk@34509 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 2c399e7c43..949453e159 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -1737,7 +1737,7 @@ function wp_new_comment_notify_postauthor( $comment_ID ) { } // Only send notifications for approved comments. - if ( 'spam' === $comment->comment_approved || ! $comment->comment_approved ) { + if ( ! isset( $comment->comment_approved ) || 'spam' === $comment->comment_approved || ! $comment->comment_approved ) { return false; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 953ecfd9a8..4f5520f3dd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34544'; +$wp_version = '4.4-alpha-34545'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.