WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#31199 new defect (bug)

Potential reference to unset variable in get_bulk_actions (WP_Posts_List_Table)

Reported by: sgrant Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch reporter-feedback
Focuses: Cc:

Description

get_post_type_object can return null in some cases, which causes a notice when current_user_can is called later in the function.

Attached a patch to check if delete_posts is set, and to only add actions if it is. Thanks!

Attachments (2)

patch.diff (626 bytes) - added by sgrant 3 years ago.
Add isset check before referencing
31199.patch (663 bytes) - added by Fab1en 3 years ago.

Download all attachments as: .zip

Change History (4)

@sgrant
3 years ago

Add isset check before referencing

#1 @Fab1en
3 years ago

  • Keywords has-patch added

Hi sgrant

Could you please provide a the way you have triggered this bug, so that I can reproduce it ?

And I think you made a mistake in your patch : $post_type_obj->delete_posts will never exist, its $post_type_obj->cap->delete_posts that has to be checked.

@Fab1en
3 years ago

#2 @DrewAPicture
3 years ago

  • Keywords reporter-feedback added
  • Version trunk deleted
Note: See TracTickets for help on using tickets.