From 2ae78644145a1a2f4256e151cfc5d5878eca9ec5 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Thu, 15 Apr 2021 11:34:44 +1000 Subject: [PATCH] Add in deprecated warning if amount is not numeric and use filter var to return appropriate amount in that case otherwise just return amount --- CRM/Core/Payment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index 491ad8939b..86ea55a019 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -1174,6 +1174,10 @@ abstract class CRM_Core_Payment { * @throws \CRM_Core_Exception */ protected function getAmount($params = []) { + if (!CRM_Utils_Rule::numeric($params['amount'])) { + CRM_Core_Error::deprecatedWarning('Passing Amount value that is not numeric is deprecated please report this in gitlab'); + return filter_var($params['amount'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); + } return $params['amount']; } -- 2.25.1