summaryrefslogtreecommitdiffstatshomepage
path: root/src/wp-includes/rest-api
diff options
context:
space:
mode:
Diffstat (limited to 'src/wp-includes/rest-api')
-rw-r--r--src/wp-includes/rest-api/class-wp-rest-response.php4
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php8
-rw-r--r--src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php12
3 files changed, 18 insertions, 6 deletions
diff --git a/src/wp-includes/rest-api/class-wp-rest-response.php b/src/wp-includes/rest-api/class-wp-rest-response.php
index c6ea11be83..0861d190d0 100644
--- a/src/wp-includes/rest-api/class-wp-rest-response.php
+++ b/src/wp-includes/rest-api/class-wp-rest-response.php
@@ -43,7 +43,7 @@ class WP_REST_Response extends WP_HTTP_Response {
/**
* Adds a link to the response.
*
- * @internal The $rel parameter is first, as this looks nicer when sending multiple.
+ * {@internal The $rel parameter is first, as this looks nicer when sending multiple.}
*
* @since 4.4.0
*
@@ -135,7 +135,7 @@ class WP_REST_Response extends WP_HTTP_Response {
/**
* Sets a single link header.
*
- * @internal The $rel parameter is first, as this looks nicer when sending multiple.
+ * {@internal The $rel parameter is first, as this looks nicer when sending multiple.}
*
* @since 4.4.0
*
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
index 4b960d6c6b..0474613b2e 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
+++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
@@ -662,11 +662,11 @@ abstract class WP_REST_Controller {
/**
* Sanitizes the slug value.
*
- * @since 4.7.0
- *
- * @internal We can't use sanitize_title() directly, as the second
+ * {@internal We can't use sanitize_title() directly, as the second
* parameter is the fallback title, which would end up being set to the
- * request object.
+ * request object.}
+ *
+ * @since 4.7.0
*
* @see https://github.com/WP-API/WP-API/issues/1585
*
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
index 004f5851a2..66cf8785e4 100644
--- a/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
+++ b/src/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;