Invalid meta causes warning in WP_Test_REST_Post_Meta_Fields
|Reported by:||timmydcrawford||Owned by:||rachelbaker|
|Component:||REST API||Keywords:||has-patch has-unit-tests commit dev-reviewed|
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.