From d4607ee8158bf157cbac29bb3be364c342ef3f52 Mon Sep 17 00:00:00 2001 From: odain Date: Tue, 2 Mar 2021 07:33:36 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B03065=20-=20Failed=20enum=20comparison=20?= =?UTF-8?q?when=20values=20contains=20parenthesis=20:=20add=20a=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/cmdbsource.class.inc.php | 1 + test/core/CMDBSourceTest.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index de7840923..285b42ed8 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -1268,6 +1268,7 @@ class CMDBSource return self::GetEnumOptions($sDataType, $sCompleteFieldType); }catch(CoreException $e){ //do nothing ; especially do not block setup. + IssueLog::Warning("enum was not parsed properly: $sCompleteFieldType. it should not happen during setup."); } } diff --git a/test/core/CMDBSourceTest.php b/test/core/CMDBSourceTest.php index ee87cf2c4..229db18b5 100644 --- a/test/core/CMDBSourceTest.php +++ b/test/core/CMDBSourceTest.php @@ -21,6 +21,7 @@ class CMDBSourceTest extends ItopTestCase { protected function setUp() { + parent::setUp(); require_once(APPROOT.'/core/cmdbsource.class.inc.php'); } @@ -112,6 +113,11 @@ class CMDBSourceTest extends ItopTestCase "ENUM('value 1 (with parenthesis)','value 2') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", "enum('value 1 (with parenthesis)','value 3') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", ), + 'ENUM with different values, containing parenthesis' => array( + false, + "ENUM('value 1 ) with parenthesis)','value 2') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", + "enum('value 1 (with parenthesis)','value 3') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci", + ), ); } }