WordPress.org

Make WordPress Core

Ticket #45486: patch-45486.2.diff

File patch-45486.2.diff, 1.1 KB (added by Jean-David, 3 years ago)

Not sure of the returns formatting.

  • src/wp-includes/rest-api.php

     
    11121112 *
    11131113 * @param mixed $value The value to sanitize.
    11141114 * @param array $args  Schema array to use for sanitization.
    1115  * @return true|WP_Error
     1115 * @return int|float|string|array|boolean|mixed Based on the `$args`'s type property, returns `$value`'s type.
     1116 * If `$args['type']` is an integer the return value is an int
     1117 * If `$args['type']` is an number the return value is an float
     1118 * If `$args['type']` is an string the return value is an float
     1119 * If `$args['type']` is an array the return value is an array
     1120 * If `$args['type']` is an array the return value is an array
     1121 * If `$args['type']` is not neither of these above, then `$args['format']` is looked upon and the return value is a string
     1122 * If `$args['type']` is not neither of these above and then `$args['format']` is not defined, then the original `$value`is returned
    11161123 */
    11171124function rest_sanitize_value_from_schema( $value, $args ) {
    11181125        if ( 'array' === $args['type'] ) {