From 8f1eddef1176dc495ff5e9043617685adf16c62e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 28 Mar 2020 20:44:09 +0000 Subject: [PATCH] Comments: Ensure all elements in the array returned by `get_comment_count()` are integers. Previously elements would be a mixture of strings and integers depending on their numeric value. Props progremzion, m.usama.masood Fixes #48093 Built from https://develop.svn.wordpress.org/trunk@47526 git-svn-id: http://core.svn.wordpress.org/trunk@47301 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 30 +++++++++++++++--------------- wp-includes/version.php | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 15cb44bcc3..d6ca7616b6 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -368,13 +368,13 @@ function get_lastcommentmodified( $timezone = 'server' ) { * @return array() { * The number of comments keyed by their status. * - * @type int|string $approved The number of approved comments. - * @type int|string $awaiting_moderation The number of comments awaiting moderation (a.k.a. pending). - * @type int|string $spam The number of spam comments. - * @type int|string $trash The number of trashed comments. - * @type int|string $post-trashed The number of comments for posts that are in the trash. - * @type int $total_comments The total number of non-trashed comments, including spam. - * @type int $all The total number of pending or approved comments. + * @type int $approved The number of approved comments. + * @type int $awaiting_moderation The number of comments awaiting moderation (a.k.a. pending). + * @type int $spam The number of spam comments. + * @type int $trash The number of trashed comments. + * @type int $post-trashed The number of comments for posts that are in the trash. + * @type int $total_comments The total number of non-trashed comments, including spam. + * @type int $all The total number of pending or approved comments. * } */ function get_comment_count( $post_id = 0 ) { @@ -434,7 +434,7 @@ function get_comment_count( $post_id = 0 ) { } } - return $comment_count; + return array_map( 'intval', $comment_count ); } // @@ -1321,13 +1321,13 @@ function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_ag * @return stdClass { * The number of comments keyed by their status. * - * @type int|string $approved The number of approved comments. - * @type int|string $moderated The number of comments awaiting moderation (a.k.a. pending). - * @type int|string $spam The number of spam comments. - * @type int|string $trash The number of trashed comments. - * @type int|string $post-trashed The number of comments for posts that are in the trash. - * @type int $total_comments The total number of non-trashed comments, including spam. - * @type int $all The total number of pending or approved comments. + * @type int $approved The number of approved comments. + * @type int $moderated The number of comments awaiting moderation (a.k.a. pending). + * @type int $spam The number of spam comments. + * @type int $trash The number of trashed comments. + * @type int $post-trashed The number of comments for posts that are in the trash. + * @type int $total_comments The total number of non-trashed comments, including spam. + * @type int $all The total number of pending or approved comments. * } */ function wp_count_comments( $post_id = 0 ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 7390810657..e90e1c9ed9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47521'; +$wp_version = '5.5-alpha-47526'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.