From 9bc6809937656f49e9155b5d6a3fb148c63a2c13 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Thu, 23 Jul 2026 10:37:44 +0200 Subject: [PATCH 1/3] Fix: decode group search filter as array instead of object --- CHANGELOG.md | 6 ++++++ inc/computergroupdynamic.class.php | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e009a8..c68a730 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Fixed + +- Decode dynamic group search filter as an array instead of an object + ## [1.1.3] - 2026-05-05 ### Fixed diff --git a/inc/computergroupdynamic.class.php b/inc/computergroupdynamic.class.php index 8c4492d..a61eac8 100644 --- a/inc/computergroupdynamic.class.php +++ b/inc/computergroupdynamic.class.php @@ -29,6 +29,7 @@ */ use function Safe\json_decode; +use function Safe\unserialize; use function Safe\json_encode; use function Safe\ob_start; use function Safe\ob_get_clean; @@ -182,7 +183,7 @@ private function countDynamicItems() public function isDynamicSearchMatchComputer(Computer $computer) { // add new criteria to force computer ID - $search = json_decode((string) $this->fields['search']); + $search = json_decode((string) $this->fields['search'], true, 512, JSON_THROW_ON_ERROR); $search['criteria'][] = [ 'link' => 'AND', From d0862138f5291a09ff890c71fc74161f7d1839f7 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 28 Jul 2026 15:55:07 +0200 Subject: [PATCH 2/3] rector --- CHANGELOG.md | 2 +- rector.php | 45 +++++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac98cc6..c6f18fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [Unreleased] +## [UNRELEASED] ### Fixed diff --git a/rector.php b/rector.php index 87d418a..33fd121 100644 --- a/rector.php +++ b/rector.php @@ -28,30 +28,27 @@ * ------------------------------------------------------------------------- */ +use Rector\Configuration\RectorConfigBuilder; + require_once __DIR__ . '/../../src/Plugin.php'; -use Rector\Caching\ValueObject\Storage\FileCacheStorage; -use Rector\Config\RectorConfig; -use Rector\ValueObject\PhpVersion; +$baseline_file = __DIR__ . '/../../PluginsRector.php'; +if (!file_exists($baseline_file)) { + throw new RuntimeException( + sprintf( + 'Unable to find "%s". Running rector on a plugin requires a GLPI development checkout that ships PluginsRector.php.', + $baseline_file, + ), + ); +} + +$baseline = require $baseline_file; + +/** @var RectorConfigBuilder $config */ +$config = $baseline([ + __DIR__ . '/ajax', + __DIR__ . '/front', + __DIR__ . '/inc', +]); -return RectorConfig::configure() - ->withPaths([ - __DIR__ . '/ajax', - __DIR__ . '/front', - __DIR__ . '/inc', - ]) - ->withPhpVersion(PhpVersion::PHP_82) - ->withCache( - cacheDirectory: __DIR__ . '/var/rector', - cacheClass: FileCacheStorage::class, - ) - ->withRootFiles() - ->withParallel(timeoutSeconds: 300) - ->withImportNames(removeUnusedImports: true) - ->withPreparedSets( - deadCode: true, - codeQuality: true, - codingStyle: true, - ) - ->withPhpSets(php82: true) // apply PHP sets up to PHP 8.2 -; +return $config; From 281ed7b1e9d81744ae6cc2f02fb7752b25ea83b5 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:11:34 +0200 Subject: [PATCH 3/3] clean uninstall --- inc/computergroup.class.php | 2 ++ inc/credential.class.php | 2 ++ inc/databaseparam.class.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/inc/computergroup.class.php b/inc/computergroup.class.php index cadb3f6..f655a0d 100644 --- a/inc/computergroup.class.php +++ b/inc/computergroup.class.php @@ -273,6 +273,8 @@ public static function uninstall(Migration $migration) if ($DB->tableExists($table)) { $DB->doQuery('DROP TABLE IF EXISTS `' . self::getTable() . '`'); } + + (new DisplayPreference())->deleteByCriteria(['itemtype' => self::class]); } public static function getIcon() diff --git a/inc/credential.class.php b/inc/credential.class.php index b1c4dc8..c6c852e 100644 --- a/inc/credential.class.php +++ b/inc/credential.class.php @@ -246,6 +246,8 @@ public static function uninstall(Migration $migration) if ($DB->tableExists($table)) { $DB->doQuery('DROP TABLE IF EXISTS `' . self::getTable() . '`'); } + + (new DisplayPreference())->deleteByCriteria(['itemtype' => self::class]); } public static function getIcon() diff --git a/inc/databaseparam.class.php b/inc/databaseparam.class.php index 4b4ecb2..5da76f2 100644 --- a/inc/databaseparam.class.php +++ b/inc/databaseparam.class.php @@ -277,6 +277,8 @@ public static function uninstall(Migration $migration) if ($DB->tableExists($table)) { $DB->doQuery('DROP TABLE IF EXISTS `' . self::getTable() . '`'); } + + (new DisplayPreference())->deleteByCriteria(['itemtype' => self::class]); } public static function getIcon()