From 701e7d4eca2451cded7b9053ece2d5661963c0b5 Mon Sep 17 00:00:00 2001 From: Lars Michelsen Date: Sat, 14 Oct 2023 21:29:41 +0200 Subject: [PATCH] Fix PHP 8.2 deprecation warnings caused by shapes on automaps and host alias fixes #357 --- ChangeLog | 1 + share/server/core/classes/objects/NagVisHost.php | 1 + share/server/core/classes/objects/NagVisShape.php | 1 + share/server/core/sources/automap.php | 14 +++++++++----- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62c4cf065..2eb7097c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 1.9.38 Frontend: * FIX: Fix XSS vulnerability + * FIX: Fix PHP 8.2 deprecation warnings caused by shapes on automaps and host alias * FIX: Fix PHP 8.2 deprecation warnings caused by gettext.inc * FIX: Fix PHP 8.2 deprecation warnings caused by std_speedometer gadget diff --git a/share/server/core/classes/objects/NagVisHost.php b/share/server/core/classes/objects/NagVisHost.php index 69923beeb..ad337541f 100644 --- a/share/server/core/classes/objects/NagVisHost.php +++ b/share/server/core/classes/objects/NagVisHost.php @@ -33,6 +33,7 @@ class NagVisHost extends NagVisStatefulObject { protected static $langServices = null; protected $host_name; + protected $alias; protected $members = array(); diff --git a/share/server/core/classes/objects/NagVisShape.php b/share/server/core/classes/objects/NagVisShape.php index 9e08f6a54..d5cd23213 100644 --- a/share/server/core/classes/objects/NagVisShape.php +++ b/share/server/core/classes/objects/NagVisShape.php @@ -29,6 +29,7 @@ class NagVisShape extends NagVisStatelessObject { protected $enable_refresh; protected $icon; + protected $icon_size; /** * Class constructor diff --git a/share/server/core/sources/automap.php b/share/server/core/sources/automap.php index 70bdd8a99..27afbd2bd 100644 --- a/share/server/core/sources/automap.php +++ b/share/server/core/sources/automap.php @@ -378,12 +378,12 @@ function automap_obj($MAPCFG, &$params, &$saved_config, $obj_name) { $obj['.width'] = $w; $obj['.height'] = $h; - } - $obj['label_show'] = $MAPCFG->getValue(0, 'label_show'); - $obj['label_border'] = $MAPCFG->getValue(0, 'label_border'); - $obj['label_background'] = $MAPCFG->getValue(0, 'label_background'); - $obj['label_maxlen'] = $MAPCFG->getValue(0, 'label_maxlen'); + $obj['label_show'] = $MAPCFG->getValue(0, 'label_show'); + $obj['label_border'] = $MAPCFG->getValue(0, 'label_border'); + $obj['label_background'] = $MAPCFG->getValue(0, 'label_background'); + $obj['label_maxlen'] = $MAPCFG->getValue(0, 'label_maxlen'); + } // Header menu has z-index 100, this object's label the below+1 $obj['z'] = 98; @@ -610,6 +610,10 @@ function automap_tree_to_map_config($MAPCFG, &$params, &$saved_config, &$map_con } $map_config[$tree['object_id']] = $tree; + + // Remove automap internal attribute from <<>> node + if ($map_config[$tree['object_id']]['type'] == 'shape') + unset($map_config[$tree['object_id']]['host_name']); // Remove internal attributes here unset($map_config[$tree['object_id']]['.childs']);