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

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 24 01:30:32 UTC 2011


#16956: Comments Being Pulled from Non-Existent Post Types
-------------------------+-----------------------------
 Reporter:  sterlo       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  3.1
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 Originally on: #10461

 I'm running standard LAMP on the latest trunk.

 Just viewing the dashboard with no plugins activated:
 {{{
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 918
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 918
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 918
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 918
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 918
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 918
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 919
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 Notice: Trying to get property of non-object in /Users/grok/Projects/Local
 Development/wordpress/trunk/wp-includes/capabilities.php on line 922
 }}}

 It's not recognizing "$post_type->cap" as valid.

 And...here's why - I added this (/wp-includes/capabilities.php):
 {{{
  918 echo "POST TYPE: Y U NO OBJECT?\n";
  919 var_dump($post_type);
 }}}

 And got:
 {{{
 POST TYPE: Y U NO OBJECT?
 NULL
 }}}

 So in this context...the post type is null and the code was not expecting
 that.

 Opening the actual $post object:
 {{{
 stdClass Object
 (
     [ID] => 60
     [post_author] => 1
     [post_date] => 2011-01-28 19:46:23
     [post_date_gmt] => 2011-01-28 19:46:23
     [post_content] => CONTENT!
     [post_title] => I have it all!
     [post_excerpt] =>
     [post_status] => publish
     [comment_status] => open
     [ping_status] => open
     [post_password] =>
     [post_name] => i-have-it-all
     [to_ping] =>
     [pinged] =>
     [post_modified] => 2011-01-28 19:46:28
     [post_modified_gmt] => 2011-01-28 19:46:28
     [post_content_filtered] =>
     [post_parent] => 0
     [guid] => http://dev.wordpress.local/?post_type=staff_listing&p=60
     [menu_order] => 0
     [post_type] => staff_listing
     [post_mime_type] =>
     [comment_count] => 6
     [ancestors] => Array
         (
         )

     [filter] => raw
 )
 }}}

 I think the problem might be custom post types or custom taxonomies...

 So my custom post type in another plugin is creating:
 "?post_type=staff_listing".
 And this post does show "[post_type] => staff_listing". BUT the plugin
 that had created these comments...is de-activated.

 Activating the plugin resolves this issue.

 So, whats a viable solution? Telling a developer to clean up after the
 plugin (removing content just because of deactivation), OR having
 WordPress not pull data (e.g. comments) that are assigned to other data
 (e.g. post types) that don't exist?

 Old Code: Give me all comments.

 New Code: Give me all comments that are tied to existing objects.

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


More information about the wp-trac mailing list