CustomVariable: more care when cloning

This commit is contained in:
Thomas Gelf 2016-02-23 00:24:38 +01:00
parent 070d05d4a8
commit 2ba404c2c7
1 changed files with 6 additions and 2 deletions

View File

@ -89,7 +89,11 @@ abstract class CustomVariable implements IcingaConfigRenderer
{ {
$this->modified = $modified; $this->modified = $modified;
if (! $this->modified) { if (! $this->modified) {
$this->storedValue = clone($this->value); if (is_object($this->value)) {
$this->storedValue = clone($this->value);
} else {
$this->storedValue = $this->value;
}
} }
return $this; return $this;
@ -180,7 +184,7 @@ abstract class CustomVariable implements IcingaConfigRenderer
} }
$var->loadedFromDb = true; $var->loadedFromDb = true;
$var->modified = false; $var->setUnmodified();
return $var; return $var;
} }