[wp-trac] [WordPress Trac] #42238: Notice when Rest Comments controler is checking permision for a non existent post type

WordPress Trac noreply at wordpress.org
Wed Nov 6 02:35:39 UTC 2019


#42238: Notice when Rest Comments controler is checking permision for a non
existent post type
-------------------------------------------------+-------------------------
 Reporter:  dragosh635                           |       Owner:
                                                 |  TimothyBlynJacobs
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  REST API                             |     Version:  4.7
 Severity:  normal                               |  Resolution:
 Keywords:  needs-patch needs-unit-tests good-   |     Focuses:
  first-bug                                      |
-------------------------------------------------+-------------------------
Changes (by TimothyBlynJacobs):

 * keywords:  has-patch => needs-patch needs-unit-tests good-first-bug
 * version:  4.8.2 => 4.7
 * milestone:  Awaiting Review => Future Release


Comment:

 Thanks for the patch @subrataemfluence! And apologies for the delay in
 getting to your ticket @dragosh635.

 Looking at the code, `WP_REST_Posts_Controller::check_read_permission()`
 will return false if the post type isn't registered. So instead of trying
 to adjust the `WP_REST_Posts_Controller` constructor to allow for invalid
 post types, I think it'd be best to short circuit
 `WP_REST_Comments_Controller::check_read_post_permission()` and return
 false if the post type does not exist.

 @subrataemfluence are you interested in writing a new patch?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/42238#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list