From 277dc3aeb286c4c4f3ff37ebb1f6180556aa4904 Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Mon, 13 Jul 2026 16:37:48 +0200 Subject: [PATCH 1/6] Fix(Migration): prevent container name corruption on partial update --- inc/container.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/inc/container.class.php b/inc/container.class.php index 6f38c4dd..8f16ac71 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -241,6 +241,7 @@ public static function installBaseData(Migration $migration, $version) $update_data = [ 'id' => $container['id'], 'itemtypes' => $itemtypes, + 'label' => $container['label'], ]; if ($container_name !== $container['name']) { $update_data['name'] = $container_name; @@ -648,7 +649,11 @@ public function defineTabs($options = []) public function prepareInputForUpdate($input) { - return PluginFieldsToolbox::prepareLabel($input); + // if label not empty, prepare name from label + if (isset($input['label']) && !empty($input['label'])) { + $input = PluginFieldsToolbox::prepareLabel($input); + } + return $input; } public function prepareInputForAdd($input) From 56010a8e60ae4eed446fe0d73f6fa01cabbca741 Mon Sep 17 00:00:00 2001 From: Stanislas Date: Mon, 13 Jul 2026 17:26:04 +0200 Subject: [PATCH 2/6] Update inc/container.class.php --- inc/container.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/container.class.php b/inc/container.class.php index 8f16ac71..9eec6e32 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -649,9 +649,10 @@ public function defineTabs($options = []) public function prepareInputForUpdate($input) { + // if label not empty, prepare name from label // if label not empty, prepare name from label if (isset($input['label']) && !empty($input['label'])) { - $input = PluginFieldsToolbox::prepareLabel($input); + $input['label'] = PluginFieldsToolbox::sanitizeLabel((string) ($input['label'] ?? '')); } return $input; } From adc12e96d0cf7fb877d801eb13b4cb9a89525e36 Mon Sep 17 00:00:00 2001 From: Stanislas Kita <7335054+stonebuzz@users.noreply.github.com> Date: Wed, 15 Jul 2026 08:31:45 +0200 Subject: [PATCH 3/6] fix CS --- inc/container.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/container.class.php b/inc/container.class.php index 9eec6e32..171b95e7 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -649,11 +649,11 @@ public function defineTabs($options = []) public function prepareInputForUpdate($input) { - // if label not empty, prepare name from label // if label not empty, prepare name from label if (isset($input['label']) && !empty($input['label'])) { $input['label'] = PluginFieldsToolbox::sanitizeLabel((string) ($input['label'] ?? '')); } + return $input; } From 57d900d8f323a0fbacbf1eb4ecc694478ef01564 Mon Sep 17 00:00:00 2001 From: Herafia Date: Mon, 27 Jul 2026 16:14:24 +0200 Subject: [PATCH 4/6] fix --- CHANGELOG.md | 3 +++ inc/container.class.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f81f8269..26932ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] +### Fixed + +- Remove redundant null coalescing on container label preparation. ## [1.24.2] - 2026-06-30 diff --git a/inc/container.class.php b/inc/container.class.php index 171b95e7..495124b9 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -651,7 +651,7 @@ public function prepareInputForUpdate($input) { // if label not empty, prepare name from label if (isset($input['label']) && !empty($input['label'])) { - $input['label'] = PluginFieldsToolbox::sanitizeLabel((string) ($input['label'] ?? '')); + $input['label'] = PluginFieldsToolbox::sanitizeLabel((string) $input['label']); } return $input; From fc68b719e0fb04a57c750625740df44840475977 Mon Sep 17 00:00:00 2001 From: "Romain B." <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 28 Jul 2026 08:10:52 +0200 Subject: [PATCH 5/6] Apply suggestion from @Rom1-B --- inc/container.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/container.class.php b/inc/container.class.php index 10bab408..ea8d3ac8 100644 --- a/inc/container.class.php +++ b/inc/container.class.php @@ -649,7 +649,7 @@ public function defineTabs($options = []) public function prepareInputForUpdate($input) { - // if label not empty, prepare name from label + // sanitize label only; name is intentionally left untouched here (see migration callers) if (isset($input['label']) && !empty($input['label'])) { $input['label'] = PluginFieldsToolbox::sanitizeLabel((string) $input['label']); } From d10078bc870e2ff76e35aab9003bb8b604e103bb Mon Sep 17 00:00:00 2001 From: "Romain B." <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 28 Jul 2026 08:11:44 +0200 Subject: [PATCH 6/6] Apply suggestion from @Rom1-B --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fd0843a..96d2b13a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix item creation with null value for mandatory fields - Fix search crash when two containers share a dropdown field with the same name. - Fix handle native GLPI dropdown types when binding additional fields to form destination -- Remove redundant null coalescing on container label preparation. - +- Fix container name/label corruption during GenericObject migration, which could break the migration with a MySQL identifier-length error. ## [1.24.2] - 2026-06-30