From fd984c5798e91727cb7b302079bdf7b39e462d4d Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Wed, 16 Aug 2023 13:22:39 +0200 Subject: [PATCH] Loader: Fix `Variable '$obj' is probably undefined` --- library/Icinga/Cli/Loader.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Cli/Loader.php b/library/Icinga/Cli/Loader.php index 93b8739c8..5e63f3fe6 100644 --- a/library/Icinga/Cli/Loader.php +++ b/library/Icinga/Cli/Loader.php @@ -251,6 +251,7 @@ class Loader return false; } + $obj = null; try { if ($this->moduleName) { $this->app->getModuleManager()->loadModule($this->moduleName); @@ -267,7 +268,7 @@ class Loader $obj->init(); return $obj->{$this->actionName . 'Action'}(); } catch (Exception $e) { - if ($obj && $obj instanceof Command && $obj->showTrace()) { + if ($obj instanceof Command && $obj->showTrace()) { fwrite(STDERR, $this->formatTrace($e->getTrace())); }