[wp-trac] [WordPress Trac] #26451: PHP notices when removing a custom post type which contains posts with attachments

WordPress Trac noreply at wordpress.org
Fri Dec 6 14:46:48 UTC 2013


#26451: PHP notices when removing a custom post type which contains posts with
attachments
--------------------------+-----------------------------
 Reporter:  Chouby        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 To reproduce, just create a plugin which registers a certain custom post
 type. Create a post in this custom post type with some attachments. De-
 activate the plugin. Go to the media list table.

 The title of the just created post is displayed without link in the column
 "uploaded to" and PHP notices are logged:
 {{{Trying to get property of non-object in /wp-includes/capabilities.php
 on 1116}}}
 Same thing for lines 1117, 1120

 The problems comes from the fact that after the line 1114
 {{{$post_type = get_post_type_object( $post->post_type );}}}
 There is no check that the returned post type is valid or not.

 In that particular case, I am not sure if we should test for the validity
 of the post type in the meta_cap function or in the calling function (line
 314 in class-wp-media-list-table.php)

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26451>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list