Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/wp-includes/rest-api/class-wp-rest-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -847,14 +847,27 @@
}

/** @var mixed|WP_Error $sanitized_value */
$sanitized_value = call_user_func( $param_args['sanitize_callback'], $value, $this, $key );
/** @var mixed|WP_Error $sanitized_value */
if ( is_array( $value ) ) {

Check failure on line 851 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Line indented incorrectly; expected 4 tabs, found 0
$sanitized_value = array_map(

Check failure on line 852 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Line indented incorrectly; expected at least 5 tabs, found 1

Check failure on line 852 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Tabs must be used to indent lines; spaces are not allowed
function ( $item ) use ( $param_args, $key ) {

Check failure on line 853 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Line indented incorrectly; expected at least 5 tabs, found 2

Check failure on line 853 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Tabs must be used to indent lines; spaces are not allowed
return call_user_func( $param_args['sanitize_callback'], $item, $this, $key );

Check failure on line 854 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Line indented incorrectly; expected at least 6 tabs, found 3

Check failure on line 854 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Tabs must be used to indent lines; spaces are not allowed
},

Check failure on line 855 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Line indented incorrectly; expected 5 tabs, found 2

Check failure on line 855 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Tabs must be used to indent lines; spaces are not allowed
$value

Check failure on line 856 in src/wp-includes/rest-api/class-wp-rest-request.php

View workflow job for this annotation

GitHub Actions / Coding standards / PHP checks

Tabs must be used to indent lines; spaces are not allowed
);
} elseif ( is_object( $value ) || is_bool( $value ) || is_null( $value ) ) {
$sanitized_value = '';
} else {
$sanitized_value = call_user_func( $param_args['sanitize_callback'], $value, $this, $key );
}

if ( is_wp_error( $sanitized_value ) ) {
$invalid_params[ $key ] = implode( ' ', $sanitized_value->get_error_messages() );
$invalid_details[ $key ] = rest_convert_error_to_response( $sanitized_value )->get_data();
} else {
$this->params[ $type ][ $key ] = $sanitized_value;
}

if ( is_wp_error( $sanitized_value ) ) {
$invalid_params[ $key ] = implode( ' ', $sanitized_value->get_error_messages() );
$invalid_details[ $key ] = rest_convert_error_to_response( $sanitized_value )->get_data();
} else {
$this->params[ $type ][ $key ] = $sanitized_value;
}
}
}

Expand Down
Loading