diff --git a/ajax/field_specific_fields.php b/ajax/field_specific_fields.php
index 9360b99f..61671293 100644
--- a/ajax/field_specific_fields.php
+++ b/ajax/field_specific_fields.php
@@ -133,7 +133,7 @@
$field->fields['default_value'] = '';
}
- $default_value = $multiple ? json_decode($field->fields['default_value']) : $field->fields['default_value'];
+ $default_value = $multiple ? json_decode((string) $field->fields['default_value']) : $field->fields['default_value'];
Dropdown::show(
$itemtype,
[
diff --git a/composer.lock b/composer.lock
index a3d65312..eb63ffd3 100644
--- a/composer.lock
+++ b/composer.lock
@@ -158,28 +158,28 @@
},
{
"name": "symfony/yaml",
- "version": "v7.3.5",
+ "version": "v7.4.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "90208e2fc6f68f613eae7ca25a2458a931b1bacc"
+ "reference": "24dd4de28d2e3988b311751ac49e684d783e2345"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/90208e2fc6f68f613eae7ca25a2458a931b1bacc",
- "reference": "90208e2fc6f68f613eae7ca25a2458a931b1bacc",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/24dd4de28d2e3988b311751ac49e684d783e2345",
+ "reference": "24dd4de28d2e3988b311751ac49e684d783e2345",
"shasum": ""
},
"require": {
"php": ">=8.2",
- "symfony/deprecation-contracts": "^2.5|^3.0",
+ "symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"symfony/console": "<6.4"
},
"require-dev": {
- "symfony/console": "^6.4|^7.0"
+ "symfony/console": "^6.4|^7.0|^8.0"
},
"bin": [
"Resources/bin/yaml-lint"
@@ -210,7 +210,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/yaml/tree/v7.3.5"
+ "source": "https://github.com/symfony/yaml/tree/v7.4.1"
},
"funding": [
{
@@ -230,7 +230,7 @@
"type": "tidelift"
}
],
- "time": "2025-09-27T09:00:46+00:00"
+ "time": "2025-12-04T18:11:45+00:00"
}
],
"packages-dev": [
@@ -345,16 +345,16 @@
},
{
"name": "symfony/console",
- "version": "v6.4.27",
+ "version": "v6.4.32",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "13d3176cf8ad8ced24202844e9f95af11e2959fc"
+ "reference": "0bc2199c6c1f05276b05956f1ddc63f6d7eb5fc3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/13d3176cf8ad8ced24202844e9f95af11e2959fc",
- "reference": "13d3176cf8ad8ced24202844e9f95af11e2959fc",
+ "url": "https://api.github.com/repos/symfony/console/zipball/0bc2199c6c1f05276b05956f1ddc63f6d7eb5fc3",
+ "reference": "0bc2199c6c1f05276b05956f1ddc63f6d7eb5fc3",
"shasum": ""
},
"require": {
@@ -419,7 +419,7 @@
"terminal"
],
"support": {
- "source": "https://github.com/symfony/console/tree/v6.4.27"
+ "source": "https://github.com/symfony/console/tree/v6.4.32"
},
"funding": [
{
@@ -439,7 +439,7 @@
"type": "tidelift"
}
],
- "time": "2025-10-06T10:25:16+00:00"
+ "time": "2026-01-13T08:45:59+00:00"
},
{
"name": "symfony/polyfill-intl-grapheme",
@@ -782,22 +782,23 @@
},
{
"name": "symfony/string",
- "version": "v7.3.4",
+ "version": "v7.4.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
- "reference": "f96476035142921000338bad71e5247fbc138872"
+ "reference": "1c4b10461bf2ec27537b5f36105337262f5f5d6f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/string/zipball/f96476035142921000338bad71e5247fbc138872",
- "reference": "f96476035142921000338bad71e5247fbc138872",
+ "url": "https://api.github.com/repos/symfony/string/zipball/1c4b10461bf2ec27537b5f36105337262f5f5d6f",
+ "reference": "1c4b10461bf2ec27537b5f36105337262f5f5d6f",
"shasum": ""
},
"require": {
"php": ">=8.2",
+ "symfony/deprecation-contracts": "^2.5|^3.0",
"symfony/polyfill-ctype": "~1.8",
- "symfony/polyfill-intl-grapheme": "~1.0",
+ "symfony/polyfill-intl-grapheme": "~1.33",
"symfony/polyfill-intl-normalizer": "~1.0",
"symfony/polyfill-mbstring": "~1.0"
},
@@ -805,11 +806,11 @@
"symfony/translation-contracts": "<2.5"
},
"require-dev": {
- "symfony/emoji": "^7.1",
- "symfony/http-client": "^6.4|^7.0",
- "symfony/intl": "^6.4|^7.0",
+ "symfony/emoji": "^7.1|^8.0",
+ "symfony/http-client": "^6.4|^7.0|^8.0",
+ "symfony/intl": "^6.4|^7.0|^8.0",
"symfony/translation-contracts": "^2.5|^3.0",
- "symfony/var-exporter": "^6.4|^7.0"
+ "symfony/var-exporter": "^6.4|^7.0|^8.0"
},
"type": "library",
"autoload": {
@@ -848,7 +849,7 @@
"utf8"
],
"support": {
- "source": "https://github.com/symfony/string/tree/v7.3.4"
+ "source": "https://github.com/symfony/string/tree/v7.4.4"
},
"funding": [
{
@@ -868,20 +869,20 @@
"type": "tidelift"
}
],
- "time": "2025-09-11T14:36:48+00:00"
+ "time": "2026-01-12T10:54:30+00:00"
},
{
"name": "twig/twig",
- "version": "v3.22.0",
+ "version": "v3.23.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
- "reference": "4509984193026de413baf4ba80f68590a7f2c51d"
+ "reference": "a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/4509984193026de413baf4ba80f68590a7f2c51d",
- "reference": "4509984193026de413baf4ba80f68590a7f2c51d",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9",
+ "reference": "a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9",
"shasum": ""
},
"require": {
@@ -935,7 +936,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
- "source": "https://github.com/twigphp/Twig/tree/v3.22.0"
+ "source": "https://github.com/twigphp/Twig/tree/v3.23.0"
},
"funding": [
{
@@ -947,18 +948,18 @@
"type": "tidelift"
}
],
- "time": "2025-10-29T15:56:47+00:00"
+ "time": "2026-01-23T21:00:41+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {},
+ "stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=8.2"
},
- "platform-dev": {},
+ "platform-dev": [],
"platform-overrides": {
"php": "8.2.99"
},
diff --git a/inc/container.class.php b/inc/container.class.php
index f31e4241..b25fadaf 100644
--- a/inc/container.class.php
+++ b/inc/container.class.php
@@ -97,9 +97,7 @@ public static function installBaseData(Migration $migration, $version)
PRIMARY KEY (`id`),
KEY `entities_id` (`entities_id`)
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
- if (!$DB->doQuery($query)) {
- throw new RuntimeException('Error creating plugin_fields_containers table: ' . $DB->error());
- }
+ $DB->doQuery($query);
}
// multiple itemtype for one container
@@ -750,7 +748,7 @@ public static function create($fields)
public static function generateTemplate($fields)
{
- $itemtypes = strlen((string) $fields['itemtypes']) > 0
+ $itemtypes = (string) $fields['itemtypes'] !== ''
? PluginFieldsToolbox::decodeJSONItemtypes($fields['itemtypes'], true)
: [];
foreach ($itemtypes as $itemtype) {
@@ -1175,7 +1173,7 @@ public static function getEntries($type = 'tab', $full = false): array
if (!in_array($item['entities_id'], $_SESSION['glpiactiveentities'])) {
if ($item['is_recursive'] == 1) {
$entities = getSonsOf('glpi_entities', $item['entities_id']);
- if (count(array_intersect($entities, $_SESSION['glpiactiveentities'])) == 0) {
+ if (array_intersect($entities, $_SESSION['glpiactiveentities']) === []) {
continue;
}
} else {
@@ -1261,7 +1259,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
// needs to check if entity of item is in hierachy of $tab_name
foreach ($container->find(['is_active' => 1, 'name' => $tab_name]) as $data) {
$dataitemtypes = PluginFieldsToolbox::decodeJSONItemtypes($data['itemtypes']);
- if (in_array($item::class, $dataitemtypes) != false) {
+ if (in_array($item::class, $dataitemtypes)) {
$entities = [$data['entities_id']];
if ($data['is_recursive']) {
$entities = getSonsOf(getTableForItemType('Entity'), $data['entities_id']);
@@ -1294,7 +1292,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $
$container = new self();
if ($container->getFromDB($tabnum)) {
$dataitemtypes = PluginFieldsToolbox::decodeJSONItemtypes($container->fields['itemtypes']);
- if (in_array($item::class, $dataitemtypes) != false) {
+ if (in_array($item::class, $dataitemtypes)) {
return PluginFieldsField::showForTabContainer($container->fields['id'], $item);
}
}
@@ -1723,7 +1721,7 @@ public static function findContainer($itemtype, $type = 'tab', $subtype = '')
foreach ($itemtypes as $data) {
$dataitemtypes = PluginFieldsToolbox::decodeJSONItemtypes($data['itemtypes']);
- if (in_array($itemtype, $dataitemtypes) != false) {
+ if (in_array($itemtype, $dataitemtypes)) {
$id = $data['id'];
}
}
@@ -1785,7 +1783,7 @@ public static function preItemUpdate(CommonDBTM $item)
//update data
$container = new self();
if (
- count($data) == 0
+ count($data) === 0
|| $container->updateFieldsValues($data, $item->getType(), isset($_REQUEST['massiveaction']))
) {
$item->input['date_mod'] = $_SESSION['glpi_currenttime'];
diff --git a/inc/field.class.php b/inc/field.class.php
index 0939fe9b..c33051df 100644
--- a/inc/field.class.php
+++ b/inc/field.class.php
@@ -94,9 +94,7 @@ public static function installBaseData(Migration $migration, $version)
KEY `is_active` (`is_active`),
KEY `is_readonly` (`is_readonly`)
) ENGINE=InnoDB DEFAULT CHARSET={$default_charset} COLLATE={$default_collation} ROW_FORMAT=DYNAMIC;";
- if (!$DB->doQuery($query)) {
- throw new RuntimeException('Error creating plugin_fields_fields table: ' . $DB->error());
- }
+ $DB->doQuery($query);
}
$migration->displayMessage('Updating ' . $table);
@@ -630,7 +628,7 @@ public function showSummary($container)
. sprintf("", $cID, $rand);
echo __('Add a new field', 'fields') . '
';
- if (count($iterator) == 0) {
+ if (count($iterator) === 0) {
echo "
| " . __('No field for this block', 'fields') . ' |
|---|