diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php index 004f5851a2..66cf8785e4 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php @@ -147,6 +147,18 @@ class WP_REST_Settings_Controller extends WP_REST_Controller { $params = $request->get_params(); + if ( empty( $params ) || ! empty( array_diff_key( $params, $options ) ) ) { + $message = empty( $params ) + ? __( 'Request body cannot be empty.' ) + : __( 'Invalid parameter(s) provided.' ); + + return new WP_Error( + 'rest_invalid_param', + $message, + array( 'status' => 400 ) + ); + } + foreach ( $options as $name => $args ) { if ( ! array_key_exists( $name, $params ) ) { continue; diff --git a/wp-includes/version.php b/wp-includes/version.php index 7884208867..30bdb96c2e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-60300'; +$wp_version = '6.9-alpha-60301'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.