summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-20 03:03:35 +0800
committer <unostar@danalan.info>2009-06-20 09:41:01 +0800
commitacadb3623b4e6c6ab5c8407c67fa12a8beb7db33 (patch)
tree6a8e1bc5d564d10e0d1060ed726832e3350e5cc6
parent4e1e429fbfa49c60fb4a24c05af1debcd433c0d4 (diff)
Catch exceptions from tag::add() that can be caused by character
encoding issues resulting from embedded keywords in encodings we can't decipher. This can lead to weird truncation issues which in turn can lead to multiple tags getting truncated to the same value in MySQL which leads to mysql complaining that we're adding a duplicate tag. Signed-off-by: <unostar@danalan.info>
-rw-r--r--modules/tag/helpers/tag_event.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index 735422b5..946326c0 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -45,7 +45,12 @@ class tag_event_Core {
// @todo figure out how to read the keywords from xmp
foreach(array_keys($tags) as $tag) {
- tag::add($photo, $tag);
+ try {
+ tag::add($photo, $tag);
+ } catch (Exception $e) {
+ Kohana::log("error", "Error adding tag: $tag\n" .
+ $e->getMessage() . "\n" . $e->getTraceAsString());
+ }
}
return;