Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#45756 closed defect (bug) (fixed)

Fix parameter name typo in 'taxonomy_meta_box_sanitize_cb_checkboxes'

Reported by: itowhid06's profile itowhid06 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.1 Priority: normal
Severity: normal Version: 5.0
Component: Taxonomy Keywords: has-patch good-first-bug dev-feedback
Focuses: Cc:

Description

Changed parameter $taxonmy to $taxonomy in 'taxonomy_meta_box_sanitize_cb_checkboxes'

Attachments (2)

45756.diff (532 bytes) - added by itowhid06 5 years ago.
45756_2.diff (500 bytes) - added by faisal03 5 years ago.

Download all attachments as: .zip

Change History (9)

@itowhid06
5 years ago

#1 follow-up: @mukesh27
5 years ago

  • Component changed from General to Taxonomy
  • Keywords good-first-bug dev-feedback added

Nice cache @itowhid06.

Do not understood why function used 2 arguments as $taxonmy is not used in function

<?php
function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonmy, $terms ) {
    return array_map( 'intval', $terms );
}

If system not used $taxonmy then need to remove first argument from the function like below.

<?php
function taxonomy_meta_box_sanitize_cb_checkboxes( $terms ) {
    return array_map( 'intval', $terms );
}

@faisal03
5 years ago

#2 @faisal03
5 years ago

As per @mukesh27 's suggestion, the $taxonmy is not used in the function, which is removed in the https://core.trac.wordpress.org/attachment/ticket/45756/45756_2.diff patch

#3 @itowhid06
5 years ago

  • Version set to 5.0

@mukesh27 @faisal03 , I don't think it's that simple! where this function is getting called, both arguments are being passed, If we want to remove the first argument, then those places should also be updated. Otherwise your proposed fix will create new issue by trying to fix a non-existent problem!

Last edited 5 years ago by itowhid06 (previous) (diff)

#4 @faisal03
5 years ago

@itowhid06 You are correct. I have checked the trunk and not able to find any calls for that function. Maybe I missed somewhere? Can you please look at your end too?

#5 @itowhid06
5 years ago

@faisal03 , taxonomy_meta_box_sanitize_cb_checkboxes has been used as a sanitization callback in class-wp-taxonomy.php - line 364. I've not got time to delve into that code yet, may be I'll give it a go when I get some time.

#6 in reply to: ↑ 1 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.1
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

Replying to mukesh27:

Do not understood why function used 2 arguments as $taxonmy is not used in function

<?php
function taxonomy_meta_box_sanitize_cb_checkboxes( $taxonmy, $terms ) {
    return array_map( 'intval', $terms );
}

Both the $taxonomy and $terms arguments are passed to the callback in edit_post().

Even though taxonomy_meta_box_sanitize_cb_checkboxes() does not use the $taxonomy argument, we cannot remove it as the function signature needs to remain compatible with taxonomy_meta_box_sanitize_cb_input(), which does use the argument. Other (custom) callbacks might use it as well.

#7 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 44367:

Taxonomy: Fix typo in taxonomy_meta_box_sanitize_cb_checkboxes() argument name.

Props itowhid06.
Fixes #45756.

Note: See TracTickets for help on using tickets.