[wp-trac] [WordPress Trac] #49991: PHP Warnings on invalid requests to wp-json/oembed/1.0/embed

WordPress Trac noreply at wordpress.org
Wed Apr 29 03:09:54 UTC 2020


#49991: PHP Warnings on invalid requests to wp-json/oembed/1.0/embed
--------------------------+------------------------------
 Reporter:  dd32          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Embeds        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  rest-api
--------------------------+------------------------------

Comment (by TimothyBlynJacobs):

 Ah, you'd need to drop the `sanitize_callback` as well.

 Routes that extend `WP_REST_Controller` and use
 `get_endpoint_args_for_item_schema` automatically apply
 `rest_(sanitize|validate)_request_arg` for the sanitize and validate
 callbacks.

 The oembed controller predates that. Instead,
 `WP_REST_Request::sanitize_params` will set `rest_parse_request_arg` as
 the sanitization callback if one isn't set, and that will apply
 `rest_sanitize_value_from_schema` and `rest_validate_value_from_schema`.

 So the definition should be.

 {{{#!php
 array(
         'description' => __( 'The URL of the resource for which to fetch
 oEmbed data.' ),
         'type'        => 'string',
         'format'      => 'uri',
         'required'    => true,
 )
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49991#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list