[wp-trac] [WordPress Trac] #40741: REST Comments Controller: Don't use count() if $request['post'] isn't an array

WordPress Trac noreply at wordpress.org
Fri May 12 07:53:24 UTC 2017


#40741: REST Comments Controller: Don't use count() if $request['post'] isn't an
array
--------------------------+-----------------------------
 Reporter:  ocean90       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  4.7
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:  rest-api      |
--------------------------+-----------------------------
 [https://wiki.php.net/rfc/counting_non_countables Counting of non-
 countable objects] will start throwing a warning in PHP 7.2.

 In the comments controller it seems like we also use `count()` on an
 integer value: https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/rest-api/endpoints/class-wp-rest-comments-
 controller.php?marks=1536&rev=40606#L1529

 Output of a build with PHP Nightly: https://travis-ci.org/WordPress
 /wordpress-develop/jobs/231375211#L1311-L1664

 Introduced in [39349].

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


More information about the wp-trac mailing list