From 514fcae8766bd84fd33a8da7bd0aaf21c93408b7 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Thu, 19 Oct 2023 16:27:06 -0400 Subject: [PATCH] fixes core#4709: type error in custom field display --- CRM/Core/BAO/CustomField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 1e9d48d0d7..24fa5a409b 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1326,7 +1326,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { // In such cases we could just get intval($value) and fetch matching // option again, but this would not work if key is float like 5.6. // So we need to truncate trailing zeros to make it work as expected. - if ($display === '' && strpos(($value ?? ''), '.') !== FALSE) { + if ($display === '' && is_numeric($value) && strpos(($value ?? ''), '.') !== FALSE) { // Use round() to truncate trailing zeros, e.g: // 10.00 -> 10, 10.60 -> 10.6, 10.69 -> 10.69. $value = (string) round($value, 5); -- 2.25.1