#29043 closed defect (bug) (duplicate)
Add checks for empty objects in capabilities.php
Reported by: | DeBAAT | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | Role/Capability | Keywords: | |
Focuses: | administration | Cc: |
Description
The Media table shows an error in the column "Uploaded to" for media referring to a post with an unknown post_type (on page "/wp-admin/upload.php").
Code analysis and debugging showed that the function "map_meta_cap()" in the file "/wp-includes/capabilities.php" was using $post_type objects which might be "null", e.g. on line 1126.
The patch file included has several suggestions for solving this issue.
The issue arose because I uploaded some media using the Hueman theme which defines a custom post_type "option-tree". When another theme is activated, e.g. Twenty Fourteen, the definition of the custom post_type is revoked.
In my test environment, I can reproduce the defect activating and de-activating the Hueman theme for the media uploaded.
I would like to ask for help to create a smaller and easier test to verify this defect. It might involve creating a (media or parent) post with a non-existing post_type.
Patch file with differences for "capabilities.php".