From a9d35ea1c7ea0015211e758bdb1df8ca33a64368 Mon Sep 17 00:00:00 2001 From: Codeweavers Infrastructure <36475663+infraweavers@users.noreply.github.com> Date: Fri, 28 Feb 2025 09:05:47 +0000 Subject: [PATCH 1/2] New version of omd-labs-5.50 does not work with deprecated templates Since upgrading our monitoring boxes to Debian 12 (Bookworm), this broke our pnp4nagios graphs. This happened because due to the new PHP version installed and the dynamic properties being deprecated. Example of error: "Creation of dynamic property Special_Controller::$templates is deprecated" --- share/pnp/application/controllers/special.php | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/share/pnp/application/controllers/special.php b/share/pnp/application/controllers/special.php index 98d86cf5..b25de0c6 100644 --- a/share/pnp/application/controllers/special.php +++ b/share/pnp/application/controllers/special.php @@ -6,7 +6,16 @@ * @author Joerg Linge * @license GPL */ -class Special_Controller extends System_Controller { + +class Special_Controller extends System_Controller { + + // Explicitly declare the dynamic properties + public $templates; + public $url; + public $template; + public $tpl; + public $data; + public $view; public function __construct() { @@ -15,15 +24,16 @@ public function __construct() $this->template->graph = $this->add_view('graph'); $this->templates = $this->data->getSpecialTemplates(); $this->data->GRAPH_TYPE = 'special'; - if($this->tpl == ''){ - if($this->templates) + if ($this->tpl == '') { + if ($this->templates) $this->tpl = $this->templates[0]; - url::redirect('special?tpl='.$this->tpl, 302); + url::redirect('special?tpl=' . $this->tpl, 302); } } - public function index(){ - $this->url = "?tpl=".$this->tpl; + public function index() + { + $this->url = "?tpl=" . $this->tpl; $this->template->zoom_header = $this->add_view('zoom_header'); $this->template->zoom_header->graph_width = ($this->config->conf['zgraph_width'] + 140); $this->template->zoom_header->graph_height = ($this->config->conf['zgraph_height'] + 230); @@ -38,7 +48,7 @@ public function index(){ $this->template->graph->widget_menu = $this->add_view('widget_menu'); $this->template->graph->graph_content->widget_graph = $this->add_view('widget_graph'); #print Kohana::debug($services); - $this->data->buildDataStruct('__special',$this->tpl,$this->view); + $this->data->buildDataStruct('__special', $this->tpl, $this->view); $this->template->graph->icon_box = $this->add_view('icon_box'); $this->template->graph->icon_box->position = "special"; $this->template->graph->logo_box = $this->add_view('logo_box'); @@ -48,5 +58,4 @@ public function index(){ $this->template->graph->header->title = $this->data->MACRO['TITLE']; //print Kohana::debug($this->data); } - } From 7364ec0d0f3e53c2393a5a57a3a26781d384336c Mon Sep 17 00:00:00 2001 From: Codeweavers Infrastructure <36475663+infraweavers@users.noreply.github.com> Date: Fri, 28 Feb 2025 09:07:06 +0000 Subject: [PATCH 2/2] New version of omd-labs-5.50 does not work with deprecated templates Since upgrading our monitoring boxes to Debian 12 (Bookworm), this broke our pnp4nagios graphs. This happened because due to the new PHP version installed and the dynamic properties being deprecated. Example of error: "Creation of dynamic property Special_Controller::$templates is deprecated" --- share/pnp/application/helpers/pnp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/pnp/application/helpers/pnp.php b/share/pnp/application/helpers/pnp.php index de6a7f11..7df9a920 100644 --- a/share/pnp/application/helpers/pnp.php +++ b/share/pnp/application/helpers/pnp.php @@ -100,7 +100,7 @@ public static function addToUri($fields = array(),$base = True){ if($value === ''){ continue; } - $uri .= $key."=".urlencode($value)."&"; + $uri .= $key."=".urlencode($value ?? '')."&"; } return rtrim($uri,"&"); }