CustomVariables: do not render deleted ones

fixes #2622
This commit is contained in:
Thomas Gelf 2022-09-30 13:47:05 +02:00
parent 867138abe3
commit 560e0e6520

View File

@ -162,6 +162,7 @@ class CustomVariables implements Iterator, Countable, IcingaConfigRenderer
protected function refreshIndex() protected function refreshIndex()
{ {
$this->idx = array(); $this->idx = array();
ksort($this->vars);
foreach ($this->vars as $name => $var) { foreach ($this->vars as $name => $var) {
if (! $var->hasBeenDeleted()) { if (! $var->hasBeenDeleted()) {
$this->idx[] = $name; $this->idx[] = $name;
@ -344,8 +345,7 @@ class CustomVariables implements Iterator, Countable, IcingaConfigRenderer
{ {
$out = ''; $out = '';
ksort($this->vars); foreach ($this as $key => $var) {
foreach ($this->vars as $key => $var) {
// TODO: ctype_alnum + underscore? // TODO: ctype_alnum + underscore?
$out .= $this->renderSingleVar($key, $var, $renderExpressions); $out .= $this->renderSingleVar($key, $var, $renderExpressions);
} }