From 9b41cfc801c970293cf2a1a7bff0ff4390219423 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 8a2b58fe38..e19da90c3a 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -1164,6 +1164,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