[icinga-checkins] icinga.org: icingaweb2-module-director/bugfix/loop-templateresolver-11803: DbObject: one more protection when looking up...

git at icinga.org git at icinga.org
Mon Oct 31 13:31:45 CET 2016


Module: icingaweb2-module-director
Branch: bugfix/loop-templateresolver-11803
Commit: 5921f4773f1a44fd5d2a9212ad81c53659ec597b
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=5921f4773f1a44fd5d2a9212ad81c53659ec597b

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Oct 27 19:34:11 2016 +0000

DbObject: one more protection when looking up...

...prefetched objects by name

---

 library/Director/Data/Db/DbObject.php |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/library/Director/Data/Db/DbObject.php b/library/Director/Data/Db/DbObject.php
index 44e4d45..32aa986 100644
--- a/library/Director/Data/Db/DbObject.php
+++ b/library/Director/Data/Db/DbObject.php
@@ -943,7 +943,10 @@ abstract class DbObject
     {
         $class = get_called_class();
         if (static::hasPrefetched($key)) {
-            if (is_string($key) && array_key_exists($key, self::$prefetchedNames[$class])) {
+            if (is_string($key)
+                && array_key_exists($class, self::$prefetchedNames)
+                && array_key_exists($key, self::$prefetchedNames[$class])
+            ) {
                 return self::$prefetched[$class][
                     self::$prefetchedNames[$class][$key]
                 ];
@@ -973,7 +976,10 @@ abstract class DbObject
         }
 
         if (array_key_exists($class, self::$prefetched)) {
-            if (is_string($key) && array_key_exists($key, self::$prefetchedNames[$class])) {
+            if (is_string($key)
+                && array_key_exists($class, self::$prefetchedNames)
+                && array_key_exists($key, self::$prefetchedNames[$class])
+            ) {
                 self::$prefetchStats[$class]->hitNames++;
                 return true;
             } elseif (array_key_exists($key, self::$prefetched[$class])) {



More information about the icinga-checkins mailing list