PropetyModifierToInt: fail for non-strings

fixes #2372
This commit is contained in:
Thomas Gelf 2021-08-12 11:52:31 +02:00
parent 909fac0419
commit f87eff8a21
2 changed files with 4 additions and 0 deletions

View file

@ -13,6 +13,7 @@ next (will be 1.9.0)
### Import and Sync
* FIX: string property modifiers now preserve NULL values (#2371)
* FIX: "to int" property modifiers now fails for non-string values (#2372)
* FEATURE: introduce 'disable' as your purge action on Sync (#2285)
* FEATURE: there is now a simple "group by" Property Modifier (#2317)

View file

@ -2,6 +2,7 @@
namespace Icinga\Module\Director\PropertyModifier;
use Icinga\Module\Director\Data\InvalidDataException;
use Icinga\Module\Director\Hook\PropertyModifierHook;
class PropertyModifierToInt extends PropertyModifierHook
@ -24,5 +25,7 @@ class PropertyModifierToInt extends PropertyModifierHook
if (is_string($value)) {
return (int) $value;
}
throw new InvalidDataException('String, integer or null', $value);
}
}