From 2cfa78af14480ee92164631913ef953a16db8973 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 13 Dec 2016 16:57:32 +0100 Subject: [PATCH] FieldLoader: do not fail missing fields One might have toggled template or command, sent values for missing fields might therefore be perfectly legal and should be silently ignored refs #13241 --- .../Web/Form/IcingaObjectFieldLoader.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/library/Director/Web/Form/IcingaObjectFieldLoader.php b/library/Director/Web/Form/IcingaObjectFieldLoader.php index 65a92cda..6ca16e07 100644 --- a/library/Director/Web/Form/IcingaObjectFieldLoader.php +++ b/library/Director/Web/Form/IcingaObjectFieldLoader.php @@ -92,15 +92,21 @@ class IcingaObjectFieldLoader $varName = $this->getElementVarName($prefix . $key); if ($varName === null) { - throw new IcingaException( - 'Cannot set variable value for "%s", got no such element', - $key - ); + // throw new IcingaException( + // 'Cannot set variable value for "%s", got no such element', + // $key + // ); + + // Silently ignore additional fields. One might have switched + // template or command + continue; } $el = $this->getElement($varName); if ($el === null) { - throw new IcingaException('No such element %s', $key); + // throw new IcingaException('No such element %s', $key); + // Same here. + continue; } $el->setValue($value);