Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30975 closed defect (bug) (fixed)

category_exists() unexpectedly fails due to default parent parameter

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

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
12 years ago

  • Description modified (diff)

#2 @boonebgorges
12 years ago

  • Milestone Awaiting Review → 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
12 years ago

  • Owner set to boonebgorges
  • Resolution → fixed
  • Status new → 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
12 years ago

  • Keywords commit fixed-major added
  • Resolution fixed
  • Status closed → reopened

Reopening for 4.1.1.

#5 @dd32
12 years ago

  • Resolution → fixed
  • Status reopened → 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.