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

WordPress Trac noreply at wordpress.org
Wed Nov 30 00:56:02 UTC 2016


#38989: Invalid meta causes warning in WP_Test_REST_Post_Meta_Fields
----------------------------+-----------------------------
 Reporter:  timmydcrawford  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  REST API        |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 While testing the terms endpoints I was trying to figure out how to
 properly submit meta values to the API through trial and error, and
 noticed that if the ''meta'' input is not an array, a warning is thrown in
 the logs:


 {{{
 [29-Nov-2016 23:48:58 UTC] PHP Warning:  array_key_exists() expects
 parameter 2 to be array, string given in /srv/www/wordpress-develop/src
 /wp-includes/rest-api/fields/class-wp-rest-meta-fields.php on line 128
 }}}

 We fixed a similar issue in #38553 but I don't believe we can utilize a
 similar fix here, so in the attached diff I opted to just check that the
 value is an array.  Additionally, the doc block for ''update_value''
 currently says the first attribute is a ''WP_REST_Request'' object, when
 it is actually the ''meta'' argument from the request.

 I couldn't find much documentation on meta in the terms endpoints, so I
 also opted to add some test coverage on the subject as well.

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


More information about the wp-trac mailing list