Reported by John Morahan
Drupal 5.2 taxonomy.module
If a user uses free tagging to add a '%' symbol as a tag, it is
impossible for anyone to add any further tags as they all get changed to
'%'.
This is because taxonomy_get_term_by_name() does a 'LIKE' match instead
of '='.
Someone with 'administer taxonomy' permission can manually delete the
offending term, fixing the problem until it gets added again.
Related issue (6.x): http://drupal.org/node/165160
To reproduce:
1. create a free tagging vocabulary, assign to a node type
2. create a node of that type, add % as a tag
3. edit the node, or create a new node of that type, add different tags,
and save again
4. observe that % was saved as a tag, and any other tags were not
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | taxonomy_get_term_by_name-like.patch | 671 bytes | john morahan |
| #3 | taxonomy_get_term_by_name-like.patch | 914 bytes | john morahan |
Comments
Comment #1
wmostrey commentedThis still applies, and this can also be tested on groups.drupal.org. For instance if you try to enter "3rd party software" as a tag, it will get replaced with "3%" since it appears someone added that as a tag already. This is not a critical issue but really should be fixed because it interferes with the user experience and is experienced as a bug (which it is).
Comment #2
wmostrey commentedComment #3
john morahan commentedComment #4
Rowanw commentedApplied the patch and followed the steps above, no problems.
Comment #5
wmostrey commentedApplies cleanly and works as advertised.
Comment #6
cburschkaThis issue still exists in D6.
Comment #7
john morahan commentedWell, in D6 the order was reversed, so it's not exactly the same issue: it's now impossible to add a tag with % in it, if the pattern matches an existing tag. Still a problem though.
Comment #8
cburschkaThis bug and corresponding patch still apply. Please do not forget to backport this to D5.
Comment #9
cburschkaClarified title.
Comment #10
gábor hojtsyThanks, committed. Should also be fixed in Drupal 5 and Drupal 7. Putting to Drupal 7 first, because it has the same code (presumably), so it should be easy to commit there and then set back for Drupal 5.
Comment #11
dries commentedCommitted this to CVS HEAD. Thanks John. Changing version.
Comment #12
drummCommitted to 5.x
Comment #13
gchan commentedTo get better performance, may want to use strtolower first instead of inside the SQL:
$db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER(t.name) = '%s' ", 't', 'tid'), strtolower(trim($name)));
Comment #14
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.