[wp-trac] [WordPress Trac] #41457: WP_REST_Comments_Controller::check_read_post_permission() counts an uncountable value

WordPress Trac noreply at wordpress.org
Thu Jul 27 16:43:20 UTC 2017


#41457: WP_REST_Comments_Controller::check_read_post_permission() counts an
uncountable value
--------------------------+------------------------------------------
 Reporter:  johnbillion   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.9
Component:  Comments      |    Version:  4.7
 Severity:  normal        |   Keywords:  needs-patch needs-unit-tests
  Focuses:  rest-api      |
--------------------------+------------------------------------------
 From #40109.

 In `WP_REST_Comments_Controller::check_read_post_permission()`, `count()`
 is called on `$request['post']`, but the value of this variable isn't
 always countable. This causes a warning in PHP 7.2.

 From some testing, `$request['post']` can be an integer, an empty array,
 an array of integers, or null. All of these types need to be accounted for
 in this method's logic.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41457>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list