[wp-trac] [WordPress Trac] #39881: `WP_REST_Posts_Controller::check_read_permission()` should check if `$parent` exists before calling itself

WordPress Trac noreply at wordpress.org
Mon Mar 20 04:42:02 UTC 2017


#39881: `WP_REST_Posts_Controller::check_read_permission()` should check if
`$parent` exists before calling itself
---------------------------------------------+--------------------------
 Reporter:  GhostToast                       |       Owner:  rachelbaker
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  4.7.4
Component:  REST API                         |     Version:  4.7
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  rest-api
---------------------------------------------+--------------------------

Comment (by rachelbaker):

 @jnylen0 This can occur when a post and related post_meta are deleted with
 a MySQL query, instead of using `wp_delete_post()`.  An attachment can
 have only one `post_parent` in WordPress but be used in multiple posts
 (talk about functionality that is kinda broken).  Is this situation
 common?  NO.  Should our REST API endpoints return invalid data due to PHP
 Errors when it does?  I wouldn't consider attachment pages as an apple to
 apple comparison for our media endpoint.

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


More information about the wp-trac mailing list