From 7652b05f4dba6b8b9ed46ebeb64000e31e83ae5e Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Mon, 29 Mar 2021 13:54:24 -0400 Subject: [PATCH] trigger an error if non-numeric --- CRM/Utils/Money.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Money.php b/CRM/Utils/Money.php index acf785d201..e81330950b 100644 --- a/CRM/Utils/Money.php +++ b/CRM/Utils/Money.php @@ -192,7 +192,12 @@ class CRM_Utils_Money { if (!extension_loaded('intl') || !is_numeric($amount)) { // @todo - we should not attempt to format non-numeric strings. For now // these will not fail but will give notices on php 7.4 - self::missingIntlNotice(); + if (!is_numeric($amount)) { + CRM_Core_Error::deprecatedWarning('Formatting non-numeric values is no longer supported: ' . htmlspecialchars($amount)); + } + else { + self::missingIntlNotice(); + } return self::formatNumericByFormat($amount, '%!.' . $numberOfPlaces . 'i'); } $money = Money::of($amount, CRM_Core_Config::singleton()->defaultCurrency, new CustomContext($numberOfPlaces), RoundingMode::HALF_UP); -- 2.25.1