Validate inc/dec operation value is numeric

This commit is contained in:
Jake Barnby 2025-10-07 23:33:19 +13:00
parent eb7306a4fa
commit 066e0bc236
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -202,6 +202,11 @@ class Operation extends Validator
$this->description = "Key '{$attributeKey}' is required in data for {$action}";
return false;
}
// Validate 'value' is numeric if provided (defaults to 1 if omitted)
if (\array_key_exists('value', $value['data']) && !\is_numeric($value['data']['value'])) {
$this->description = "Key 'value' must be a numeric value for {$action}";
return false;
}
}
return true;