[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 14:38:33 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                                      |
-------------------------------------------------+-------------------------

Comment (by subrataemfluence):

 Thank you @TimothyBlynJacobs for giving me the opportunity. Unfortunately
 I am travelling right now and won't be able to work on this for next few
 days. I am fine and actually would be great if somebody else completes it.
 :)

 Replying to [comment:12 TimothyBlynJacobs]:
 > 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:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list