Opened 14 years ago
Closed 14 years ago
#17839 closed defect (bug) (duplicate)
map_meta_cap PHP Notices when Post type is no longer registered
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.2 |
| Component: | Warnings/Notices | Keywords: | needs-patch |
| Focuses: | Cc: |
Description
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.
Change History (2)
Note: See
TracTickets for help on using
tickets.