[wp-trac] [WordPress Trac] #16956: Comments Being Pulled from Non-Existent Post Types

WordPress Trac wp-trac at lists.automattic.com
Sun Jun 19 08:04:51 UTC 2011


#16956: Comments Being Pulled from Non-Existent Post Types
------------------------------+------------------------------
 Reporter:  sterlo            |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Warnings/Notices  |     Version:  3.1
 Severity:  normal            |  Resolution:
 Keywords:                    |
------------------------------+------------------------------
Changes (by dd32):

 * keywords:  dev-feedback =>
 * type:  enhancement => defect (bug)
 * component:  General => Warnings/Notices


Comment:

 Closed #17839 as duplicate.

 > Noticed in the recent comments widget:
 {{{
 ( ! ) Notice: Trying to get property of non-object in C:\www\wordpress-
 commit\wp-includes\capabilities.php on line 929
 Call Stack
 #       Time    Memory  Function        Location
 1       0.0005  360328  {main}( )       ..\index.php:0
 2       0.3960  24624984        wp_dashboard( ) ..\index.php:63
 3       0.3960  24625272        do_meta_boxes( string(9), string(6),
 string(0) )        ..\dashboard.php:221
 4       0.8141  25014760        call_user_func ( string(28), string(0),
 array(4) )      ..\template.php:970
 5       0.8141  25014776        wp_dashboard_recent_comments( string(0),
 array(4) )     ..\template.php:0
 6       0.8171  25271192        current_user_can( string(9), string(3) )
 ..\dashboard.php:632
 7       0.8171  25271784        call_user_func_array ( array(2), array(2)
 )     ..\capabilities.php:1047
 8       0.8171  25272048        WP_User->has_cap( string(9), string(3) )
 ..\capabilities.php:0
 9       0.8172  25272448        call_user_func_array ( string(12),
 array(3) )   ..\capabilities.php:729
 10      0.8172  25272736        map_meta_cap( string(9), string(1),
 string(3) ) ..\capabilities.php:0
 }}}

 > Turns out, that it's a comment on a custom post type that's no longer
 registered.

 > As a result $post_type = get_post_type_object( $post->post_type ); fails
 to return a valid post type object (however, get_post() can still return
 the cpt) which results in the code operating on a null object.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16956#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list