WordPress.org

Make WordPress Core

Changeset 45687


Ignore:
Timestamp:
07/27/2019 01:43:41 PM (3 months ago)
Author:
ocean90
Message:

REST API: Pass current request object to rest_authentication_errors filter in WP_REST_Server::check_authentication().

Fixes #46907.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r45611 r45687  
    104104     *
    105105     * @since 4.4.0
    106      *
     106     * @since 5.3.0 Added the `$request` parameter.
     107     *
     108     * @param WP_REST_Request $request Full data about the request.
    107109     * @return WP_Error|null WP_Error indicates unsuccessful login, null indicates successful
    108110     *                       or no authentication provided
    109111     */
    110     public function check_authentication() {
     112    public function check_authentication( $request ) {
    111113        /**
    112114         * Filters REST authentication errors.
     
    129131         *
    130132         * @since 4.4.0
    131          *
    132          * @param WP_Error|null|bool WP_Error if authentication error, null if authentication
    133          *                              method wasn't used, true if authentication succeeded.
    134          */
    135         return apply_filters( 'rest_authentication_errors', null );
     133         * @since 5.3.0 Added the `$request` argument.
     134         *
     135         * @param WP_Error|null|bool $result  WP_Error if authentication error, null if authentication
     136         *                                    method wasn't used, true if authentication succeeded.
     137         * @param WP_REST_Request    $request Full data about the request.
     138         */
     139        return apply_filters( 'rest_authentication_errors', null, $request );
    136140    }
    137141
     
    324328        }
    325329
    326         $result = $this->check_authentication();
     330        $result = $this->check_authentication( $request );
    327331
    328332        if ( ! is_wp_error( $result ) ) {
Note: See TracChangeset for help on using the changeset viewer.