WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 20 months ago

#40741 closed defect (bug) (duplicate)

REST Comments Controller: Don't use count() if $request['post'] isn't an array

Reported by: ocean90 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Comments Keywords:
Focuses: rest-api Cc:
PR Number:

Description

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].

Change History (2)

#1 @birgire
21 months ago

  • Milestone Awaiting Review deleted

This seems to be fixed in [41735] for the ticket #41457

Should this one be closed as a duplicate, even though it's an older one?

#2 @ocean90
20 months ago

  • Keywords needs-patch removed
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #41457.

Note: See TracTickets for help on using tickets.