From e49980bdc18095955dfeed91ca7bc0fa8f3d3af0 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 30 Aug 2015 02:19:21 +0000 Subject: [PATCH] `get_comment_count()` currently increments `awaiting_moderation` when comments are in the trash. This occurs because `case 0:` will match any value passed to `switch` that is a string that isn't specified in the list of cases. This is terrifying. * Cases for `0` and `1` should be `'1'` and `'0'` * Add unit tests for `get_comment_count()`. Currently, there are none. See #33414. Built from https://develop.svn.wordpress.org/trunk@33806 git-svn-id: http://core.svn.wordpress.org/trunk@33774 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 26d66cd2fa..930d1897f7 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -375,11 +375,11 @@ function get_comment_count( $post_id = 0 ) { $comment_count['spam'] = $row['total']; $comment_count["total_comments"] += $row['total']; break; - case 1: + case '1': $comment_count['approved'] = $row['total']; $comment_count['total_comments'] += $row['total']; break; - case 0: + case '0': $comment_count['awaiting_moderation'] = $row['total']; $comment_count['total_comments'] += $row['total']; break; diff --git a/wp-includes/version.php b/wp-includes/version.php index 56d206d0c5..8636f67fdd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33805'; +$wp_version = '4.4-alpha-33806'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.