[wp-trac] [WordPress Trac] #53593: The `permissions_check()` methods are missing the `$request` parameter

WordPress Trac noreply at wordpress.org
Mon Jul 5 15:26:11 UTC 2021


#53593: The `permissions_check()` methods are missing the `$request` parameter
--------------------------+-------------------------
 Reporter:  johnbillion   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  5.8
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-------------------------
 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.

 1. 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
 2. 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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53593>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list