Make WordPress Core

Ticket #38984: 38984.2.diff

File 38984.2.diff, 1.6 KB (added by rachelbaker, 8 years ago)

Changes strval() back to (string) typecasting

  • src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

     
    10271027         * @return WP_Error|string The sanitized username, if valid, otherwise an error.
    10281028         */
    10291029        public function check_username( $value, $request, $param ) {
    1030                 $username = (string) rest_sanitize_value_from_schema( $value, $request, $param );
     1030                $username = (string) $value;
    10311031
    10321032                if ( ! validate_username( $username ) ) {
    10331033                        return new WP_Error( 'rest_user_invalid_username', __( 'Username contains invalid characters.' ), array( 'status' => 400 ) );
     
    10561056         * @return WP_Error|string The sanitized password, if valid, otherwise an error.
    10571057         */
    10581058        public function check_user_password( $value, $request, $param ) {
    1059                 $password = (string) rest_sanitize_value_from_schema( $value, $request, $param );
     1059                $password = (string) $value;
    10601060
    10611061                if ( empty( $password ) ) {
    10621062                        return new WP_Error( 'rest_user_invalid_password', __( 'Passwords cannot be empty.' ), array( 'status' => 400 ) );
  • src/wp-includes/rest-api.php

     
    840840        }
    841841        $args = $attributes['args'][ $param ];
    842842
    843         return rest_sanitize_value_from_schema( $value, $args, $param );
     843        return rest_sanitize_value_from_schema( $value, $args );
    844844}
    845845
    846846/**