IcingaException: Only use `vsprintf()` if `$args` given

If the passed message contains a `%`, but no `$args`, `vsprintf()` throws an error.
This commit is contained in:
Sukhwinder Dhillon 2023-02-15 10:41:26 +01:00 committed by Johannes Meyer
parent 10d3fb64f9
commit 5000d3117b
1 changed files with 6 additions and 1 deletions

View File

@ -25,7 +25,12 @@ class IcingaException extends Exception
$exc = $arg; $exc = $arg;
} }
} }
parent::__construct(vsprintf($message, $args), 0, $exc);
if (! empty($args)) {
$message = vsprintf($message, $args);
}
parent::__construct($message, 0, $exc);
} }
/** /**