[wp-trac] [WordPress Trac] #29589: term_exists() short-circuits and results in duplicate inserts.
WordPress Trac
noreply at wordpress.org
Mon Sep 8 20:26:29 UTC 2014
#29589: term_exists() short-circuits and results in duplicate inserts.
-----------------------------+-----------------------------
Reporter: georgestephanis | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: trunk
Severity: normal | Keywords: needs-patch
Focuses: |
-----------------------------+-----------------------------
If you are using a term that gets stripped down to an empty string -- like
`//` or `>>` by `sanitize_title()` then it will be able to be
inserted into the database properly, but any future checks to
`term_exists()` will lie to you and tell you that it doesn't exist.
This is inconsistent behavior, and can cause database errors where keys
are duplicated as it tries to insert the same term into the database
twice.
Here's some unit tests that demonstrate the current issue. I'm not sure
the ideal place to fix it, I suspect it's the conditional in term_exists,
but we may want to just modify terms to always reject something that can't
produce a slug. Uncertain.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29589>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list