Changeset 56192 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 07/10/2023 10:46:22 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r56082 r56192 474 474 } else { 475 475 $url = trailingslashit( get_home_url( $blog_id, '', $scheme ) ); 476 // nginx only allows HTTP/1.0 methods when redirecting from / to /index.php. 477 // To work around this, we manually add index.php to the URL, avoiding the redirect. 476 /* 477 * nginx only allows HTTP/1.0 methods when redirecting from / to /index.php. 478 * To work around this, we manually add index.php to the URL, avoiding the redirect. 479 */ 478 480 if ( ! str_ends_with( $url, 'index.php' ) ) { 479 481 $url .= 'index.php'; … … 633 635 } 634 636 635 // While WP_HTTP_Response is the base class of WP_REST_Response, it doesn't provide 636 // all the required methods used in WP_REST_Server::dispatch(). 637 /* 638 * While WP_HTTP_Response is the base class of WP_REST_Response, it doesn't provide 639 * all the required methods used in WP_REST_Server::dispatch(). 640 */ 637 641 if ( $response instanceof WP_HTTP_Response ) { 638 642 return new WP_REST_Response( … … 946 950 947 951 foreach ( $fields as $accepted_field ) { 948 // Check to see if $field is the parent of any item in $fields. 949 // A field "parent" should be accepted if "parent.child" is accepted. 952 /* 953 * Check to see if $field is the parent of any item in $fields. 954 * A field "parent" should be accepted if "parent.child" is accepted. 955 */ 950 956 if ( str_starts_with( $accepted_field, "$field." ) ) { 951 957 return true; 952 958 } 953 // Conversely, if "parent" is accepted, all "parent.child" fields 954 // should also be accepted. 959 /* 960 * Conversely, if "parent" is accepted, all "parent.child" fields 961 * should also be accepted. 962 */ 955 963 if ( str_starts_with( $field, "$accepted_field." ) ) { 956 964 return true; … … 1610 1618 ); 1611 1619 1612 // Both arrays and objects allow empty strings to be converted to their types. 1613 // But the best answer for this type is a string. 1620 /* 1621 * Both arrays and objects allow empty strings to be converted to their types. 1622 * But the best answer for this type is a string. 1623 */ 1614 1624 if ( '' === $value && in_array( 'string', $types, true ) ) { 1615 1625 return 'string'; … … 2192 2202 } 2193 2203 2194 // The "format" keyword should only be applied to strings. However, for backward compatibility, 2195 // we allow the "format" keyword if the type keyword was not specified, or was set to an invalid value. 2204 /* 2205 * The "format" keyword should only be applied to strings. However, for backward compatibility, 2206 * we allow the "format" keyword if the type keyword was not specified, or was set to an invalid value. 2207 */ 2196 2208 if ( isset( $args['format'] ) 2197 2209 && ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type'], $allowed_types, true ) ) … … 2859 2871 */ 2860 2872 function rest_preload_api_request( $memo, $path ) { 2861 // array_reduce() doesn't support passing an array in PHP 5.2, 2862 // so we need to make sure we start with one. 2873 /* 2874 * array_reduce() doesn't support passing an array in PHP 5.2, 2875 * so we need to make sure we start with one. 2876 */ 2863 2877 if ( ! is_array( $memo ) ) { 2864 2878 $memo = array();
Note: See TracChangeset
for help on using the changeset viewer.