WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#30975 closed defect (bug) (fixed)

category_exists() unexpectedly fails due to default parent parameter

Reported by: hissy Owned by: boonebgorges
Milestone: 4.1.1 Priority: normal
Severity: normal Version: 4.1
Component: Taxonomy Keywords: commit fixed-major
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The default $parent value of term_exists() has been changed to null from 0, but the default $parent value of category_exists() is still 0. We need to change this to null.

[29863]

Change History (5)

#1 @SergeyBiryukov
5 years ago

  • Description modified (diff)

#2 @boonebgorges
5 years ago

  • Milestone changed from Awaiting Review to 4.1.1

Thanks for the report, hissy. To spell out the "unexpectedly fails" bit: In 4.0, category_exists(), when not passing a $parent param, will return the oldest category matching the $cat_name, regardless of parent; in 4.1, it'll return the oldest category matching $cat_name that has no parent. Fix + unit tests are incoming.

#3 @boonebgorges
5 years ago

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

In 31140:

Default $parent in category_exists() should default to null rather than 0.

[29863] made the corresponding change in term_exists(). Failure to change the
default value in category_exists() meant that an unspecified value for
$parent would limit results to top-level categories.

Includes unit tests and corrected function documentation.

Props hissy.
Fixes #30975 for trunk.

#4 @boonebgorges
5 years ago

  • Keywords commit fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 4.1.1.

#5 @dd32
5 years ago

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

In 31376:

Default $parent in category_exists() should default to null rather than 0.

[29863] made the corresponding change in term_exists(). Failure to change the
default value in category_exists() meant that an unspecified value for
$parent would limit results to top-level categories.

Includes unit tests and corrected function documentation.

Props hissy.
Merges [31140] to the 4.1 branch.
Fixes #30975.

Note: See TracTickets for help on using tickets.