Make WordPress Core

Opened 6 weeks ago

#60947 new defect (bug)

calling get_post_type_object in wp-admin/includes/post.php may return null

Reported by: pcarvalho's profile pcarvalho Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: trunk
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

There's no guard to check the return of get_post_type_object, going straight to use labels and then all_items

/wp-admin/includes/post.php:1816

$sendback_text = get_post_type_object( $post->post_type )->labels->all_items;

get_post_type_object returns:

WP_Post_Type|null WP_Post_Type object if it exists, null otherwise.

if valid, i can provide a patch.

Change History (0)

Note: See TracTickets for help on using tickets.