From 4e1aca4e3c77d71913a512332a5b3d99f291a223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 2 Mar 2017 11:36:20 +0100 Subject: [PATCH 1/2] don't store empty groupids gives an exception on oracle and shouldn't be added in the first place Signed-off-by: Morris Jobke --- lib/private/SystemTag/SystemTagManager.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index 7c21c0e004..d0854e885e 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -400,6 +400,9 @@ class SystemTagManager implements ISystemTagManager { 'gid' => $query->createParameter('gid'), ]); foreach ($groupIds as $groupId) { + if ($groupId === '') { + continue; + } $query->setParameter('gid', $groupId); $query->execute(); } From c96486cfaec95d75a8bb9069481528982ec1b98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 2 Mar 2017 14:17:20 +0100 Subject: [PATCH 2/2] test setTagGroups with empty groupids Signed-off-by: Morris Jobke --- tests/lib/SystemTag/SystemTagManagerTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index e697e37346..61fac99ca6 100644 --- a/tests/lib/SystemTag/SystemTagManagerTest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -516,6 +516,15 @@ class SystemTagManagerTest extends TestCase { $this->assertEquals([], $this->tagManager->getTagGroups($tag2)); } + /** + * empty groupIds should be ignored + */ + public function testEmptyTagGroup() { + $tag1 = $this->tagManager->createTag('tag1', true, false); + $this->tagManager->setTagGroups($tag1, ['']); + $this->assertEquals([], $this->tagManager->getTagGroups($tag1)); + } + /** * @param ISystemTag $tag1 * @param ISystemTag $tag2