Correctly deal with sql case insensitivity.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 29 Jan 2009 22:34:52 +0000 (17:34 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 29 Jan 2009 22:39:28 +0000 (17:39 -0500)
content/lib/Tagger.php

index cef7606..973b9b2 100644 (file)
@@ -642,8 +642,13 @@ class Content_Tagger
         // Get the ids for any tags that already exist.
         if (count($tagText)) {
             foreach ($this->_db->selectAll('SELECT tag_id, tag_name FROM ' . $this->_t('tags') . ' WHERE tag_name IN ('.implode(',', array_map(array($this->_db, 'quote'), array_keys($tagText))).')') as $row) {
-                $tagIndex = $tagText[$row['tag_name']];
-                unset($tagText[$row['tag_name']]);
+                $tagTextCopy = $tagText;
+                foreach ($tagTextCopy as $tag => $tagIndex) {
+                    if (strtolower($row['tag_name']) == strtolower($tag)) {
+                        unset($tagText[$tag]);
+                        break;
+                    }
+                }
                 $tagIds[$tagIndex] = $row['tag_id'];
             }
         }