From 5000d3117b3395a7b9e0a588925f027f36b4566e Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Wed, 15 Feb 2023 10:41:26 +0100 Subject: [PATCH] IcingaException: Only use `vsprintf()` if `$args` given If the passed message contains a `%`, but no `$args`, `vsprintf()` throws an error. --- library/Icinga/Exception/IcingaException.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Exception/IcingaException.php b/library/Icinga/Exception/IcingaException.php index a87ea4a8f..3519a9abd 100644 --- a/library/Icinga/Exception/IcingaException.php +++ b/library/Icinga/Exception/IcingaException.php @@ -25,7 +25,12 @@ class IcingaException extends Exception $exc = $arg; } } - parent::__construct(vsprintf($message, $args), 0, $exc); + + if (! empty($args)) { + $message = vsprintf($message, $args); + } + + parent::__construct($message, 0, $exc); } /**