From 560e0e6520d6e28a9205f8e5b6c1752e22aaba2e Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 30 Sep 2022 13:47:05 +0200 Subject: [PATCH] CustomVariables: do not render deleted ones fixes #2622 --- library/Director/CustomVariable/CustomVariables.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Director/CustomVariable/CustomVariables.php b/library/Director/CustomVariable/CustomVariables.php index ca043aa0..cdcc4bd7 100644 --- a/library/Director/CustomVariable/CustomVariables.php +++ b/library/Director/CustomVariable/CustomVariables.php @@ -162,6 +162,7 @@ class CustomVariables implements Iterator, Countable, IcingaConfigRenderer protected function refreshIndex() { $this->idx = array(); + ksort($this->vars); foreach ($this->vars as $name => $var) { if (! $var->hasBeenDeleted()) { $this->idx[] = $name; @@ -344,8 +345,7 @@ class CustomVariables implements Iterator, Countable, IcingaConfigRenderer { $out = ''; - ksort($this->vars); - foreach ($this->vars as $key => $var) { + foreach ($this as $key => $var) { // TODO: ctype_alnum + underscore? $out .= $this->renderSingleVar($key, $var, $renderExpressions); }