diff --git a/wp-includes/rest-api/class-wp-rest-request.php b/wp-includes/rest-api/class-wp-rest-request.php index 734ee982fc..3c465babd0 100644 --- a/wp-includes/rest-api/class-wp-rest-request.php +++ b/wp-includes/rest-api/class-wp-rest-request.php @@ -683,9 +683,12 @@ class WP_REST_Request implements ArrayAccess { $error_data = array( 'status' => WP_Http::BAD_REQUEST, - 'json_error_code' => json_last_error(), - 'json_error_message' => json_last_error_msg(), ); + if ( function_exists( 'json_last_error' ) ) { + $error_data['json_error_code'] = json_last_error(); + $error_data['json_error_message'] = json_last_error_msg(); + } + return new WP_Error( 'rest_invalid_json', __( 'Invalid JSON body passed.' ), $error_data ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index a6c3eaebfe..e3844059e4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta1-39110'; +$wp_version = '4.7-beta1-39111'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.