[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 19:24:56 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:
-------------------------------------------------+-------------------------
Changes (by rachelbaker):
* keywords: has-patch has-unit-tests needs-refresh => has-patch has-unit-
tests 2nd-opinion
Comment:
In [attachment:38989.3.diff] ignore the `meta` values of a request if
attempting to update meta when `meta` is not an array. This fixes the bug
where currently a PHP warning is returned if in a create/update request
`'meta' is not an array.
I would like a 2nd opinion on the possible perception of "breakage" if we
implement the longer term fix @joehoyle has in mind.
== Explanation of what is going on in this ticket ==
Send a request to update a post with request data like so:
{{{#!json
{
'content': "Look at me changing the post_content.",
'meta': "this is not an array or object of meta keys and values!"
}
}}}
Current behavior:
- your post would update, so the content would now be "Look at me
changing the post_content.".
- the invalid string in the `meta` property would trigger a PHP Warning
which would result in invalid JSON data for your response (if a site is
set to display PHP warnings)
- the client would have an indication that **something** went wrong...
Behavior with [attachment:38989.3.diff]) applied:
- your post would update, so the content would now be "Look at me
changing the post_content.".
- the invalid string in the `meta` property would be ignored, and not
trigger an error
- the client would have **no** indication that something went wrong. :(
Proposed behavior with fixing the underlying problem in 4.8:
- the client would receive an error noting that `meta` was an invalid
param in the request
- the post would not update
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38989#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list