[wp-trac] [WordPress Trac] #53622: Query Param status default is a string value, but an array is required
WordPress Trac
noreply at wordpress.org
Fri Jul 26 11:06:30 UTC 2024
#53622: Query Param status default is a string value, but an array is required
------------------------------------------+------------------------------
Reporter: austyfrosty | Owner: rachelbaker
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: minor | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses: rest-api
------------------------------------------+------------------------------
Comment (by ironprogrammer):
Thanks for the report, @austyfrosty!
Since r39104, the default for `status` was changed from string to array to
support querying multiple post statuses. However, string was/is still
supported for backward compatibility.
This suggested change, while making the `status` param default consistent
with the newer expected type, would introduce a backwards compatibility
issue. Parts of this controller have been
[https://wpdirectory.net/search/01J3Q9526QAH1FDBZQ0SFNXNN0 copied as-is in
userland code], and for example could impact how
`sanitize_post_statuses()` [https://github.com/wordpress/wordpress-
develop/blob/349590c8135b003857b47ff1a4636dc283d8b71c/src/wp-includes
/rest-api/endpoints/class-wp-rest-posts-controller.php#L3017 assumes the
default is a string].
I suggest `wontfix` on this, though perhaps the code could be documented
to indicate this inconsistency.
Props @antonvlasenko and @azaozz for additional in-person discussion.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53622#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list