From 6f3395ad19d6588c8e5533510b5863a418f82ab9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 1 Apr 2015 01:30:37 +0200 Subject: [PATCH] Prevent a Tag from becoming a synonym of itself MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Previously this only was checked by PHP in the controller, but MySQL thinks that letters with an accent are equal to their base form. For example: e = é. Previously entering such a combination would lead to an endless recursion, now these synonyms are silently ignored. --- wcfsetup/install/files/lib/data/tag/TagEditor.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wcfsetup/install/files/lib/data/tag/TagEditor.class.php b/wcfsetup/install/files/lib/data/tag/TagEditor.class.php index cfe2c0a242..bb05bc58a0 100644 --- a/wcfsetup/install/files/lib/data/tag/TagEditor.class.php +++ b/wcfsetup/install/files/lib/data/tag/TagEditor.class.php @@ -25,6 +25,8 @@ class TagEditor extends DatabaseObjectEditor { * @param \wcf\data\tag\Tag $synonym */ public function addSynonym(Tag $synonym) { + if ($synonym->tagID == $this->tagID) return; + // assign all associations for the synonym with this tag $sql = "UPDATE IGNORE wcf".WCF_N."_tag_to_object SET tagID = ? -- 2.20.1