WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 8 months 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 8 months ago.
12729.2.diff (715 bytes) - added by wonderboymusic 8 months ago.
12729.3.diff (1.6 KB) - added by ryan 8 months ago.
With unit tests that demonstrate the behavior change

Download all attachments as: .zip

Change History (14)

comment:1 westi4 years ago

dd32 and I were discussing this the other day.

I think there might already be a ticket for it.

let me search.

comment:2 nacin4 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.

comment:3 nacin4 years ago

  • Milestone changed from 3.0 to 3.1

comment:4 nacin3 years ago

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

comment:5 stephenh19882 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?

comment:6 Otto4217 months ago

  • Cc Otto42 added

comment:7 nacin11 months ago

#24216 was marked as a duplicate.

wonderboymusic8 months ago

comment:8 wonderboymusic8 months 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

wonderboymusic8 months ago

comment:9 wonderboymusic8 months ago

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

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

ryan8 months ago

With unit tests that demonstrate the behavior change

comment:10 ryan8 months 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.

comment:11 wonderboymusic8 months 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.