Make WordPress Core


Ignore:
Timestamp:
03/28/2020 08:42:31 PM (5 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

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

    r47397 r47526  
    369369 *     The number of comments keyed by their status.
    370370 *
    371  *     @type int|string $approved            The number of approved comments.
    372  *     @type int|string $awaiting_moderation The number of comments awaiting moderation (a.k.a. pending).
    373  *     @type int|string $spam                The number of spam comments.
    374  *     @type int|string $trash               The number of trashed comments.
    375  *     @type int|string $post-trashed        The number of comments for posts that are in the trash.
    376  *     @type int        $total_comments      The total number of non-trashed comments, including spam.
    377  *     @type int        $all                 The total number of pending or approved comments.
     371 *     @type int $approved            The number of approved comments.
     372 *     @type int $awaiting_moderation The number of comments awaiting moderation (a.k.a. pending).
     373 *     @type int $spam                The number of spam comments.
     374 *     @type int $trash               The number of trashed comments.
     375 *     @type int $post-trashed        The number of comments for posts that are in the trash.
     376 *     @type int $total_comments      The total number of non-trashed comments, including spam.
     377 *     @type int $all                 The total number of pending or approved comments.
    378378 * }
    379379 */
     
    435435    }
    436436
    437     return $comment_count;
     437    return array_map( 'intval', $comment_count );
    438438}
    439439
     
    13221322 *     The number of comments keyed by their status.
    13231323 *
    1324  *     @type int|string $approved       The number of approved comments.
    1325  *     @type int|string $moderated      The number of comments awaiting moderation (a.k.a. pending).
    1326  *     @type int|string $spam           The number of spam comments.
    1327  *     @type int|string $trash          The number of trashed comments.
    1328  *     @type int|string $post-trashed   The number of comments for posts that are in the trash.
    1329  *     @type int        $total_comments The total number of non-trashed comments, including spam.
    1330  *     @type int        $all            The total number of pending or approved comments.
     1324 *     @type int $approved       The number of approved comments.
     1325 *     @type int $moderated      The number of comments awaiting moderation (a.k.a. pending).
     1326 *     @type int $spam           The number of spam comments.
     1327 *     @type int $trash          The number of trashed comments.
     1328 *     @type int $post-trashed   The number of comments for posts that are in the trash.
     1329 *     @type int $total_comments The total number of non-trashed comments, including spam.
     1330 *     @type int $all            The total number of pending or approved comments.
    13311331 * }
    13321332 */
Note: See TracChangeset for help on using the changeset viewer.