[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 16:39:47 UTC 2016


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

 * keywords:   => needs-refresh has-patch


Comment:

 A few comments on the proposed solution in [attachment:fix-meta-
 warnings.diff]:

 1. Checking the `meta` value type so far down in the request processing
 means that if I am updating a full object (as in the title and content for
 a post IN ADDITION to the meta values) the post's title and content would
 be updated on the post object, but I would receive a `WP_Error` for my
 request.  We should do this check near the beginning of the
 `create_item()` and `update_item()` methods in the object controllers.

 2. We cannot create a new error message because we are in string freeze
 for 4.7.  Instead, the WP_Error message should match the strings we use
 with the `rest_invalid_param` errors.

 3. The unit tests included by @timmydcrawford do not appear to be testing
 anything in the scope of this ticket.  I agree with @jnylen0 that we
 should unit tests for sending `meta` values that are "invalid" in a
 request, but we should also move the unrelated tests to a new ticket.
 @timmydcrawford would you be able to create a new ticket with your tests?

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


More information about the wp-trac mailing list