From aec79bebcda35fac513328f3f3bed6fbcd2f2812 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Fri, 17 Sep 2021 16:54:05 +0100 Subject: [PATCH] Fix PropertyBag setRecurInstallments to accept 0 --- Civi/Payment/PropertyBag.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Civi/Payment/PropertyBag.php b/Civi/Payment/PropertyBag.php index 25e4a1d369..6b39c0f74c 100644 --- a/Civi/Payment/PropertyBag.php +++ b/Civi/Payment/PropertyBag.php @@ -1037,7 +1037,10 @@ class PropertyBag implements \ArrayAccess { */ public function setRecurInstallments($recurInstallments, $label = 'default') { // Counts zero as positive which is ok - means no installments - if (!\CRM_Utils_Type::validate($recurInstallments, 'Positive')) { + try { + \CRM_Utils_Type::validate($recurInstallments, 'Positive'); + } + catch (\CRM_Core_Exception $e) { throw new InvalidArgumentException('recurInstallments must be 0 or a positive integer'); } -- 2.25.1