[wp-trac] [WordPress Trac] #38989: Invalid meta causes warning in WP_Test_REST_Post_Meta_Fields

WordPress Trac noreply at wordpress.org
Thu Dec 1 21:17:20 UTC 2016


#38989: Invalid meta causes warning in WP_Test_REST_Post_Meta_Fields
-------------------------------------------------+-------------------------
 Reporter:  timmydcrawford                       |       Owner:
     Type:  defect (bug)                         |  rachelbaker
 Priority:  normal                               |      Status:  assigned
Component:  REST API                             |   Milestone:  4.7
 Severity:  normal                               |     Version:  trunk
 Keywords:  has-patch has-unit-tests 2nd-        |  Resolution:
  opinion                                        |     Focuses:
-------------------------------------------------+-------------------------

Comment (by jnylen0):

 Replying to [comment:7 rachelbaker]:
 > Our schema ignores the sanitization or validation callbacks in top-level
 parameters

 I think the real issue is that `meta` is declared with type `object`,
 which we don't validate at all yet, no?  The full fix will be to support
 `object` in schemas in a future version.

 Replying to [comment:6 joehoyle]:
 > I think we should be able to add an `arg_options` here
 https://github.com/WordPress/WordPress/blob/master/wp-includes/rest-
 api/fields/class-wp-rest-meta-fields.php#L393 to specify a custom validate
 callback for this schema item.

 Good suggestion, this seems to be working quite well in
 [attachment:38989.4.diff].

 Replying to [comment:8 rachelbaker]:
 > I would like a 2nd opinion on the possible perception of "breakage" if
 we implement the longer term fix @joehoyle has in mind.

 I think we should avoid this future behavior change if possible.

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


More information about the wp-trac mailing list