WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 6 years ago

#12729 closed defect (bug) (fixed)

Fix [6326] - wp_unique_term_slug() when changing the parent

Reported by: nacin Owned by: ryan
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch commit
Focuses: Cc:

Description

[6326] uses $args (as an array) when it appears it should use $term (an object).

It's never worked, so I'm hesitant to patch it as I imagine it might break something elsewhere in the taxonomy API.

Assigning to ryan for now, who authored the commit.

Attachments (3)

12729.diff (715 bytes) - added by wonderboymusic 6 years ago.
12729.2.diff (715 bytes) - added by wonderboymusic 6 years ago.
12729.3.diff (1.6 KB) - added by ryan 6 years ago.
With unit tests that demonstrate the behavior change

Download all attachments as: .zip

Change History (14)

#1 @westi
9 years ago

dd32 and I were discussing this the other day.

I think there might already be a ticket for it.

let me search.

#2 @nacin
9 years ago

  • Milestone changed from Unassigned to 3.0

Yeah, dd32 and I discussed this as well, and he mentioned he had discussed it with you. I couldn't find another ticket and so I said I would create one.

#3 @nacin
9 years ago

  • Milestone changed from 3.0 to 3.1

#4 @nacin
9 years ago

  • Keywords dev-feedback added
  • Milestone changed from Awaiting Triage to Future Release

#5 @stephenh1988
8 years ago

  • Cc stephenh1988 added

If fixed, it will simply return the slug if it is already the slug for the term. Would that not be expected behavior?

#6 @Otto42
7 years ago

  • Cc Otto42 added

#7 @nacin
6 years ago

#24216 was marked as a duplicate.

@wonderboymusic
6 years ago

#8 @wonderboymusic
6 years ago

  • Keywords has-patch needs-testing needs-unit-tests added; dev-feedback removed
  • Milestone changed from Future Release to 3.7

Things like this really scare me

#9 @wonderboymusic
6 years ago

  • Keywords commit added; needs-testing needs-unit-tests removed

.2.diff is from develop root - all existing unit tests pass

@ryan
6 years ago

With unit tests that demonstrate the behavior change

#10 @ryan
6 years ago

That unit tests passes with the patch and fails without. This code is not really exercised since wp_insert_post() and wp_update_post() never call wp_unique_term_slug() in this situation. You pretty much have to call wp_unique_term_slug() directly (like the unit tests do) to trigger this.

#11 @wonderboymusic
6 years ago

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

In 25106:

Check term_id against the $term object, not the non-existent var $args. Props rboren. Fixes #12729.

Note: See TracTickets for help on using tickets.