From 74d79c61d9ca2cb6b1e787a829dc9ac06be6e110 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 16 Dec 2015 21:57:57 -0500 Subject: [PATCH] CRM-17646 - Fix display of array values --- CRM/Core/BAO/CustomField.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 977298b499..022a823669 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1191,7 +1191,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { private static function formatDisplayValue($value, $field, $contactID = NULL) { if (self::isSerialized($field) && !is_array($value)) { - $value = (array) CRM_Utils_Array::explodePadded($value); + $value = CRM_Utils_Array::explodePadded($value); } // CRM-12989 fix if ($field['html_type'] == 'CheckBox') { @@ -1230,6 +1230,10 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { case 'Select Date': $customFormat = NULL; + // FIXME: Are there any legitimate reasons why $value would be an array? + // Or should we throw an exception here if it is? + $value = is_array($value) ? CRM_Utils_Array::first($value) : $value; + $actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats(); $format = CRM_Utils_Array::value('date_format', $field); -- 2.25.1