Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#29043 closed defect (bug) (duplicate)

Add checks for empty objects in capabilities.php

Reported by: debaat's profile 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.

Attachments (1)

#29043-capabilities.php.patch (3.0 KB) - added by DeBAAT 10 years ago.
Patch file with differences for "capabilities.php".

Download all attachments as: .zip

Change History (3)

@DeBAAT
10 years ago

Patch file with differences for "capabilities.php".

#1 @DrewAPicture
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #16956.

#2 @SergeyBiryukov
10 years ago

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").

See #27446 for 4.0.

Note: See TracTickets for help on using tickets.