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

WordPress Trac noreply at wordpress.org
Tue Apr 28 07:36:12 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 dd32):

 @TimothyBlynJacobs Thanks for following up, Are there any build steps that
 need to be done?

 It doesn't look like `rest_validate_request_arg()` runs at all in my test
 environments with just `type` specified.
 Using `{ type: string, validate_callback: rest_validate_request_arg }`
 appears to work though.

 > For some reason adding is_string as the validate_callback didn't help.
 (Which is why it's an anonymous function wrapping it)
 For reference, it probably didn't work for me as `is_string()` needs 1
 param and using it here as it was, passed 3.

 > It looks like the type => string parameter still causes a PHP Notice as
 it's simply run through strval() and not actually validated/rejected.
 I can't duplicate the PHP Notice now, I'm not sure what combination of
 things I set to trigger that.

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


More information about the wp-trac mailing list