WordPress.org

Make WordPress Core

Opened 5 weeks ago

Last modified 8 hours ago

#45611 new defect (bug)

REST API: Attachment controller calls undefined parent method

Reported by: dlh Owned by:
Milestone: 5.2 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch needs-unit-tests
Focuses: Cc:

Description

WP_REST_Attachments_Controller contains a public validate_user_can_query_private_statuses() method that ends with a call to parent::validate_user_can_query_private_statuses(). However, the parent method was removed in [39104].

It seems possibly unintentional that the method still exists at all in WP_REST_Attachments_Controller; I don't see any uses of it in core.

The attached patch would update the method to pass to the parent sanitize_post_statuses() method that was added in [39104]. (Perhaps validate_user_can_query_private_statuses() should also be deprecated?)

Attachments (1)

45611.diff (734 bytes) - added by dlh 5 weeks ago.

Download all attachments as: .zip

Change History (6)

@dlh
5 weeks ago

#1 @SergeyBiryukov
5 weeks ago

  • Milestone changed from Awaiting Review to 5.1

This ticket was mentioned in Slack in #core-restapi by desrosj. View the logs.


8 days ago

#3 @desrosj
8 days ago

  • Keywords has-unit-tests added

This is looking good. It would be great to have some tests, though. @dlh are you able to tackle that?

#4 @dlh
7 days ago

  • Keywords needs-unit-tests added; has-unit-tests removed

I'll do my best to add tests in time for 5.1!

#5 @pento
8 hours ago

  • Milestone changed from 5.1 to 5.2

Aye, this should probably be deprecated. I'm nearly inclined to just remove it, except that it is technically possible to call it without causing a PHP error.

Either way, I'd prefer to land this early, so moving to 5.2.

Note: See TracTickets for help on using tickets.