WordPress.org

Make WordPress Core

Changeset 41735


Ignore:
Timestamp:
10/04/2017 03:37:48 PM (3 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r41731 r41735  
    15141514
    15151515        // Only check password if a specific post was queried for or a single comment
    1516         $requested_post = ! empty( $request['post'] ) && 1 === count( $request['post'] );
     1516        $requested_post = ! empty( $request['post'] ) && ( !is_array( $request['post'] ) || 1 === count( $request['post'] ) );
    15171517        $requested_comment = ! empty( $request['id'] );
    15181518        if ( ( $requested_post || $requested_comment ) && $posts_controller->can_access_password_content( $post, $request ) ) {
Note: See TracChangeset for help on using the changeset viewer.