Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #41457, comment 2


Ignore:
Timestamp:
07/28/2017 01:55:47 PM (9 years ago)
Author:
ayeshrajans

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #41457, comment 2

    initial v1  
     1Please see the patch above.
     2The `!empty($request['post'])` call there prevents false-y values from continuing. `false`, `null`, empty strings, and empty arrays should be thrown off here. This leaves us with the post ID either being a single string/int value, or an array of values. Earlier, `count()` returned `1` for both `count(12345)` and `count(array(12345))`. Now, because the `!empty()` call has thrown off false-y values, we only need to check there is one array element only if the `$request['post']` value is an array.
     3
     4--
     5
    16The warnings thrown from this particular `count()` call is `count(): Parameter must be an array or an object that implements Countable`.
    27Build log: https://travis-ci.org/WordPress/wordpress-develop/jobs/258395218 (find for `/home/travis/build/WordPress/wordpress-develop/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php:1514`). There are 30 instances of it.