[icinga-checkins] icinga.org: icingaweb2-module-director/master: CustomVariable: more care when cloning

git at icinga.org git at icinga.org
Tue Feb 23 03:15:20 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: 2ba404c2c7b7282dd0f7f517a1fd50c2107fbbaa
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=2ba404c2c7b7282dd0f7f517a1fd50c2107fbbaa

Author: Thomas Gelf <thomas at gelf.net>
Date:   Tue Feb 23 00:24:38 2016 +0100

CustomVariable: more care when cloning

---

 library/Director/CustomVariable/CustomVariable.php |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/library/Director/CustomVariable/CustomVariable.php b/library/Director/CustomVariable/CustomVariable.php
index 4fee15f..3ee08f2 100644
--- a/library/Director/CustomVariable/CustomVariable.php
+++ b/library/Director/CustomVariable/CustomVariable.php
@@ -89,7 +89,11 @@ abstract class CustomVariable implements IcingaConfigRenderer
     {
         $this->modified = $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;
@@ -180,7 +184,7 @@ abstract class CustomVariable implements IcingaConfigRenderer
         }
 
         $var->loadedFromDb = true;
-        $var->modified = false;
+        $var->setUnmodified();
         return $var;
     }
 



More information about the icinga-checkins mailing list