Opened 3 years ago
Closed 3 years ago
#53593 closed defect (bug) (fixed)
The `permissions_check()` methods are missing the `$request` parameter
Reported by: | johnbillion | Owned by: | desrosj |
---|---|---|---|
Milestone: | 5.8 | Priority: | normal |
Severity: | normal | Version: | 5.8 |
Component: | REST API | Keywords: | has-patch commit dev-reviewed fixed-major |
Focuses: | Cc: |
Description
The WP_REST_Templates_Controller::permissions_check()
and WP_REST_Widgets_Controller::permissions_check()
methods are called by other methods within their respective classes but the $request
parameter gets lost along the way.
- The
WP_REST_Templates_Controller
class does pass the parameter but it's not implemented: https://github.com/WordPress/wordpress-develop/blob/5383af84832fa27c187941a63803fea8bdb553ca/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php#L139 - The
WP_REST_Widgets_Controller
class doesn't pass the parameter: https://github.com/WordPress/wordpress-develop/blob/5383af84832fa27c187941a63803fea8bdb553ca/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php#L286
If somebody wants to extend one of these classes and override the permissions_check()
method they can't implement and make use of the $request
parameter because it makes the signature incompatible.
The $request
parameter of the permissions_check()
method should be implemented even though it's not used by default
Change History (8)
This ticket was mentioned in PR #1464 on WordPress/wordpress-develop by johnbillion.
3 years ago
#1
- Keywords has-patch added; needs-patch removed
#3
@
3 years ago
This seems to make sense to me. It's also consistent with other controllers in Core.
@TimothyBlynJacobs any reason not to make this change at this point in the cycle?
#6
@
3 years ago
- Owner set to desrosj
- Resolution set to fixed
- Status changed from new to closed
In 51349:
Trac ticket: https://core.trac.wordpress.org/ticket/53593