REST API: Reverse order of setting sanitization/validation, validating prior to sanitizing.

Fixes mistake in the current behavior, where the sanitization callback ran before the validation callback. Now the validation callback will run before the sanitization.

Props schlessera, rachelbaker.
See #37247.
Fixes #37192.



Built from https://develop.svn.wordpress.org/trunk@37943


git-svn-id: http://core.svn.wordpress.org/trunk@37884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Rachel Baker 2016-07-02 23:03:27 +00:00
parent 318fec4dcd
commit e5fcbb3514
2 changed files with 3 additions and 3 deletions

View File

@ -853,8 +853,6 @@ class WP_REST_Server {
$request->set_url_params( $args );
$request->set_attributes( $handler );
$request->sanitize_params();
$defaults = array();
foreach ( $handler['args'] as $arg => $options ) {
@ -869,6 +867,8 @@ class WP_REST_Server {
if ( is_wp_error( $check_required ) ) {
$response = $check_required;
}
$request->sanitize_params();
}
if ( ! is_wp_error( $response ) ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-beta1-37942';
$wp_version = '4.6-beta1-37943';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.