[wp-trac] [WordPress Trac] #60947: calling get_post_type_object in wp-admin/includes/post.php may return null
WordPress Trac
noreply at wordpress.org
Sat Apr 6 17:46:52 UTC 2024
#60947: calling get_post_type_object in wp-admin/includes/post.php may return null
-------------------------------+-----------------------------
Reporter: pcarvalho | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: trunk
Severity: minor | Keywords:
Focuses: |
-------------------------------+-----------------------------
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
{{{#!php
$sendback_text = get_post_type_object( $post->post_type
)->labels->all_items;
}}}
[https://developer.wordpress.org/reference/functions/get_post_type_object
get_post_type_object] returns:
WP_Post_Type|**[[span(style=color: #FF0000, null )]]** WP_Post_Type
object if it exists, null otherwise.
if valid, i can provide a patch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60947>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list