From 6029c2bf7a3b57289e16545b98ed2a5aa3f71be2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 19 Jun 2009 12:03:35 -0700 Subject: 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. --- modules/tag/helpers/tag_event.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/tag/helpers') 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; -- cgit v1.2.3