#60947 closed defect (bug) (fixed)
calling get_post_type_object in wp-admin/includes/post.php may return null
Reported by: | pcarvalho | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | minor | Version: | 3.6 |
Component: | Posts, Post Types | Keywords: | has-patch |
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 (7)
#1
in reply to:
↑ description
@
2 months ago
- Milestone changed from Awaiting Review to 6.7
- Version changed from 6.6 to 3.6
This ticket was mentioned in PR #7280 on WordPress/wordpress-develop by @akshat2802.
6 weeks ago
#2
- Keywords has-patch added
This PR adds a check for the function get_post_type_object not returning null.
https://core.trac.wordpress.org/ticket/60947
#3
@
6 weeks ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 58983:
@SergeyBiryukov commented on PR #7280:
6 weeks ago
#4
Thanks for the PR! Merged in r58983.
#5
follow-ups:
↓ 6
↓ 7
@
6 weeks ago
Hi @SergeyBiryukov ,
Thank you for the mention in this ticket. However, it seems that my username has been listed incorrectly as "akshat280." My correct username is "akshat2802." Could you kindly update the reference?
Regards
Akshat
#6
in reply to:
↑ 5
@
6 weeks ago
My correct username is "akshat2802."
It's corrected in Core Props.
#7
in reply to:
↑ 5
@
6 weeks ago
Replying to akshat2802:
Thank you for the mention in this ticket. However, it seems that my username has been listed incorrectly as "akshat280."
Sorry for the typo, and thanks to @sabernhardt for correcting it :)
Replying to pcarvalho:
Hi there, thanks for the ticket! This does seem valid, would you be interested in working on a patch?
Introduced in [24527] / #24547.