From 43b53cfb1344ba955978c3c90a9eb2b682324542 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Fri, 12 Aug 2011 09:40:28 -0400
Subject: [PATCH] - Patch #1078398 by xjm, BayerMeister: Fixed
 taxonomy_implode_tags() modifies term objects (instead of cloning) and adds
 extra ' when called multiple times.

---
 modules/taxonomy/taxonomy.module | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 946c5e4a7f2e..eb81870f9983 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -1236,10 +1236,11 @@ function taxonomy_implode_tags($tags, $vid = NULL) {
       if (isset($tag->name)) {
         // Commas and quotes in tag names are special cases, so encode 'em.
         if (strpos($tag->name, ',') !== FALSE || strpos($tag->name, '"') !== FALSE) {
-          $tag->name = '"' . str_replace('"', '""', $tag->name) . '"';
+          $typed_tags[] = '"' . str_replace('"', '""', $tag->name) . '"';
+        }
+        else {
+          $typed_tags[] = $tag->name;
         }
-
-        $typed_tags[] = $tag->name;
       }
     }
   }
-- 
GitLab