From 5419d4428c86c488a43124f85e5407d7cbae6541 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:47 +0200 Subject: Adding upstream version 1.11.1. Signed-off-by: Daniel Baumann --- library/Director/IcingaConfig/AssignRenderer.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'library/Director/IcingaConfig/AssignRenderer.php') diff --git a/library/Director/IcingaConfig/AssignRenderer.php b/library/Director/IcingaConfig/AssignRenderer.php index 6acbfee..495ad1e 100644 --- a/library/Director/IcingaConfig/AssignRenderer.php +++ b/library/Director/IcingaConfig/AssignRenderer.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Director\IcingaConfig; +use gipfl\Json\JsonDecodeException; use gipfl\Json\JsonString; use Icinga\Data\Filter\Filter; use Icinga\Data\Filter\FilterAnd; @@ -128,8 +129,14 @@ class AssignRenderer } $column = $filter->getColumn(); - $rawExpression = Json::decode($filter->getExpression()); - $expression = $this->renderExpressionValue($rawExpression); + try { + $rawExpression = JsonString::decode($filter->getExpression()); + $expression = $this->renderExpressionValue($rawExpression); + } catch (JsonDecodeException $e) { + throw new InvalidArgumentException( + "Got invalid JSON in filter string: $column" . $filter->getSign() . $filter->getExpression() + ); + } if (is_array($rawExpression) && $filter instanceof FilterMatch) { return $this->renderInArray($column, $expression); -- cgit v1.2.3