Changeset 45807 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 08/15/2019 05:16:21 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r45771 r45807 1160 1160 $value = (array) $value; 1161 1161 } 1162 1163 if ( $value instanceof JsonSerializable ) { 1164 $value = $value->jsonSerialize(); 1165 } 1166 1162 1167 if ( ! is_array( $value ) ) { 1163 1168 /* translators: 1: parameter, 2: type name */ … … 1171 1176 return $is_valid; 1172 1177 } 1173 } elseif ( isset( $args['additionalProperties'] ) && false === $args['additionalProperties'] ) { 1174 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not a valid property of Object.' ), $property ) ); 1178 } elseif ( isset( $args['additionalProperties'] ) ) { 1179 if ( false === $args['additionalProperties'] ) { 1180 return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not a valid property of Object.' ), $property ) ); 1181 } 1182 1183 if ( is_array( $args['additionalProperties'] ) ) { 1184 $is_valid = rest_validate_value_from_schema( $v, $args['additionalProperties'], $param . '[' . $property . ']' ); 1185 if ( is_wp_error( $is_valid ) ) { 1186 return $is_valid; 1187 } 1188 } 1175 1189 } 1176 1190 } … … 1299 1313 $value = (array) $value; 1300 1314 } 1315 1316 if ( $value instanceof JsonSerializable ) { 1317 $value = $value->jsonSerialize(); 1318 } 1319 1301 1320 if ( ! is_array( $value ) ) { 1302 1321 return array(); … … 1306 1325 if ( isset( $args['properties'][ $property ] ) ) { 1307 1326 $value[ $property ] = rest_sanitize_value_from_schema( $v, $args['properties'][ $property ] ); 1308 } elseif ( isset( $args['additionalProperties'] ) && false === $args['additionalProperties'] ) { 1309 unset( $value[ $property ] ); 1327 } elseif ( isset( $args['additionalProperties'] ) ) { 1328 if ( false === $args['additionalProperties'] ) { 1329 unset( $value[ $property ] ); 1330 } elseif ( is_array( $args['additionalProperties'] ) ) { 1331 $value[ $property ] = rest_sanitize_value_from_schema( $v, $args['additionalProperties'] ); 1332 } 1310 1333 } 1311 1334 }
Note: See TracChangeset
for help on using the changeset viewer.