[wp-trac] [WordPress Trac] #31665: Duplicate slugs in DB, created for hierarchical terms with long, non-latin names, when the default slug already exists
WordPress Trac
noreply at wordpress.org
Tue Mar 17 10:43:35 UTC 2015
#31665: Duplicate slugs in DB, created for hierarchical terms with long, non-latin
names, when the default slug already exists
--------------------------+-----------------------------
Reporter: nevma | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.1.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
When WP automatically generates a slug for a child term, and if the
produced slug (which is normally generated just from the term's name)
already exists in that taxonomy, it forms a slug by concatenating all the
parent terms' slugs hierarchically
For example, in a term structure like:
Parent
-Child
If a term with the name "Grandchild" is to be inserted under "Child",
normally it would get the slug "grandchild". However if that slug already
exists in the taxonomy, WP generates the slug "parent-child-grandchild".
When the slugs have long, non-latin names, they are stored urlencoded in
wp_terms, and the stored string's length can easily overflow the field's
size ( varchar(200) ). Any terms created under that condition end up
having the same slug stored in the DB (the produced urlencoded one,
truncated to 200 chars).
To reproduce the issue:
Create a term (e.g. category) with this name (without the quotes): "Ένα
δύο τρία τέσσερα πέντε"
Create another term with the same name, defining the first term as its
parent.
Create a third term with the same name, defining the second term as its
parent.
The second and third terms end up having duplicate slugs in the DB, a
situation which is normally an error.
This issue is also not detected if the same procedure is repeated using
wp_insert_term(). Normally an attempt to insert a duplicate slug to the
same taxonomy would raise a "duplicate_term_slug" WP_Error, which is not
the case.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31665>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list