Subject: [PATCH] Perform json_validate before json_decode on REST API request data
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/wp-includes/rest-api/class-wp-rest-request.php b/src/wp-includes/rest-api/class-wp-rest-request.php
a
|
b
|
|
682 | 682 | return true; |
683 | 683 | } |
684 | 684 | |
| 685 | // Perform validation if json_validate is available. |
| 686 | if ( function_exists( 'json_validate' ) && json_validate( $body, true ) === false ) { |
| 687 | return new WP_Error( 'rest_invalid_json', 'Invalid JSON body passed.' ); |
| 688 | } |
| 689 | |
685 | 690 | $params = json_decode( $body, true ); |
686 | 691 | |
687 | 692 | /* |