From 17b1f66ba051dffd31f55f5f0d741190f2765882 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 4 Oct 2017 15:37:48 +0000 Subject: [PATCH] REST API: Avoid counting an uncountable type when checking read permissions for comment posts. This avoids deprecated notices from showing in PHP 7.2 and above. Props ayeshrajans Fixes #41457 git-svn-id: https://develop.svn.wordpress.org/trunk@41735 602fd350-edb4-49c9-b593-d223f7449a82 --- .../rest-api/endpoints/class-wp-rest-comments-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index 4eced8f8ae..23b1262c3c 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -1513,7 +1513,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller { $has_password_filter = false; // Only check password if a specific post was queried for or a single comment - $requested_post = ! empty( $request['post'] ) && 1 === count( $request['post'] ); + $requested_post = ! empty( $request['post'] ) && ( !is_array( $request['post'] ) || 1 === count( $request['post'] ) ); $requested_comment = ! empty( $request['id'] ); if ( ( $requested_post || $requested_comment ) && $posts_controller->can_access_password_content( $post, $request ) ) { add_filter( 'post_password_required', '__return_false' );