WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 months ago

Last modified 3 months ago

#43639 closed defect (bug) (fixed)

wp_terms_checklist post_id argument is null, should be 0

Reported by: tareiking Owned by: SergeyBiryukov
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch commit
Focuses: administration Cc:

Description

In includes/class-wp-posts-list-table.php we call wp_terms_checklist with post_id set to null.

wp_terms_checklist post_id argument should be an int and 0 is used as the default elsewhere (ie: ajax-actions.php).

Reference: https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes/class-wp-posts-list-table.php#L1543

Change History (8)

#1 @pento
3 years ago

  • Version trunk deleted

This ticket was mentioned in Slack in #core-site-health by hareesh-pillai. View the logs.


14 months ago

#3 @SergeyBiryukov
14 months ago

  • Component changed from General to Taxonomy
  • Keywords needs-patch added

This ticket was mentioned in PR #1173 on WordPress/wordpress-develop by donmhico.


7 months ago

  • Keywords has-patch added; needs-patch removed

Pass 0 instead of null on wp_terms_checklist() for consistency.

Trac ticket: https://core.trac.wordpress.org/ticket/43639

#5 @donmhico
7 months ago

Thanks for the ticket @tareiking. I've attached a PR that fixes this issue.

#6 @jrf
4 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 5.9

Reviewed and found valid. This patch should be committed.

As per the docs for the wp_terms_checklist() function, the default value is integer 0, not null.

#7 @SergeyBiryukov
3 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 51520:

Taxonomy: Pass correct default value for $post_id to wp_terms_checklist() in the posts list table.

This matches the documented type of the $post_id argument and is consistent with other instances of wp_terms_checklist() calls.

Per the function documentation, the default value is integer 0, not null.

Follow-up to [13535].

Props tareiking, donmhico, jrf.
Fixes #43639.

Note: See TracTickets for help on using tickets.