Make WordPress Core

Opened 3 years ago

Last modified 3 months ago

#53622 accepted defect (bug)

Query Param status default is a string value, but an array is required

Reported by: austyfrosty's profile austyfrosty Owned by: rachelbaker's profile rachelbaker
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: REST API Keywords: needs-patch needs-unit-tests
Focuses: rest-api Cc:

Change History (3)

#1 @rachelbaker
21 months ago

  • Keywords needs-patch added
  • Owner set to rachelbaker
  • Status changed from new to accepted

#2 @rachelbaker
21 months ago

  • Keywords needs-unit-tests added

#3 @ironprogrammer
3 months ago

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 copied as-is in userland code, and for example could impact how sanitize_post_statuses() 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.

Note: See TracTickets for help on using tickets.