#16651 closed defect (bug) (duplicate)
Warnings on dashboard: Notice: Trying to get property of non-object in wp-includes/capabilities.php
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Role/Capability | Keywords: | needs-patch |
Focuses: | Cc: |
Description
I just upgraded a local install to 3.1 and have the debug mode on. Now, on the dashboard the "Recent Comments" box is filled with notices. I will attach a screen-shot of the notices. Though this doesn't show when debug mode is off, I have to assume that something isn't working with all of these warnings.
Attachments (4)
Change History (21)
#1
@
14 years ago
- Component changed from General to Warnings/Notices
- Keywords reporter-feedback added
Do you have deactivated all your plugins?
#2
@
14 years ago
Those notices are most likely caused by a plugin doing something wrong.
Put the following gist in your mu-plugins folder to see a backtrace. https://gist.github.com/625769
#3
@
14 years ago
OK, I did a clean install of 3.1 and turned on debug mode and it does not happen. Went back to other install and removed all plugins, still happens. Then I noticed there were some comments for posts that were no longer on the site. Once I deleted those from the database the errors went away. Apparently another bug which I may not be able to track prevented these comments from deleting when the posts were deleted. I will look into that, but perhaps a check to make sure a comment is associated with a post could prevent these errors -though it is not likely to happen all that often.
#4
@
14 years ago
grandslambert, would be nice if you can add the backtrace (see scribu's comment) to investigate it.
#5
@
14 years ago
How would that help me if there are no errors showing now? The problem was bad data, likely caused by a bad plugin, and certainly not something that should be the concern of WordPress core developers. I doubt very much that any other user is going to encounter this problem.
#6
@
14 years ago
- Keywords reporter-feedback removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Okay, thanks.
#8
@
13 years ago
- Version changed from 3.1 to 3.4
Reopening this ticket, I'm having the same situation.
Twentyeleven, no plugins activated.
Although I had a plugin enabled that created a custom post type, that has comments on their custom post type posts.
More Info: I had attempted to import the "theme unit test" which had issues and failures importing, couldn't retrieve images etc.
#10
@
13 years ago
- Version changed from 3.4 to 3.0
Okay, based on the description, this should be reproducible back to 3.0.
So the issue is two-fold:
- What to do about comments on a post of a non-existent type? and
- map_meta_cap() needs to be a bit more resilient here.
#11
@
13 years ago
Is it possible to do a check under the call for get_post_type_object, since it returns null we can gather that it must have existed at some point in time and then refer to using say 'post' as a fallback for the meta_cap ? -- probably could be done cleaner in the function get_post_type_object()
if (is_null($post_type_object)) $post_type_object = get_post_type_object( 'post' );
#12
@
13 years ago
I don't think we should default to 'post' if the CPT is null.
IMO, the cap check should fail, unless the user has 'moderate_comments'.
#15
@
11 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
#16
@
11 years ago
- Component changed from Warnings/Notices to Role/Capability
- Milestone Future Release deleted
- Resolution set to duplicate
- Status changed from reopened to closed
Duplicate of #19590.
Screenshot of warning notices in the Recent Comments box on the dashboard in 3.1