WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/13/2017 04:37:03 AM (4 years ago)
Author:
SergeyBiryukov
Message:

REST API: Improve error messages for number relational validation.

Props jblz.
Fixes #39054.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r39638 r39896  
    10691069            if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) {
    10701070                /* translators: 1: parameter, 2: minimum number */
    1071                 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (exclusive)' ), $param, $args['minimum'] ) );
     1071                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d' ), $param, $args['minimum'] ) );
    10721072            } elseif ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) {
    10731073                /* translators: 1: parameter, 2: minimum number */
    1074                 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than %2$d (inclusive)' ), $param, $args['minimum'] ) );
     1074                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be greater than or equal to %2$d' ), $param, $args['minimum'] ) );
    10751075            }
    10761076        } elseif ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) {
    10771077            if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) {
    10781078                /* translators: 1: parameter, 2: maximum number */
    1079                 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (exclusive)' ), $param, $args['maximum'] ) );
     1079                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d' ), $param, $args['maximum'] ) );
    10801080            } elseif ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) {
    10811081                /* translators: 1: parameter, 2: maximum number */
    1082                 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than %2$d (inclusive)' ), $param, $args['maximum'] ) );
     1082                return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s must be less than or equal to %2$d' ), $param, $args['maximum'] ) );
    10831083            }
    10841084        } elseif ( isset( $args['maximum'] ) && isset( $args['minimum'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.