htmlspecialchars() expects parameter 1 to be string, array given in .../administrator/components/com_civicrm/civicrm/packages/HTML/Common.php on line 144
Warning: htmlspecialchars() expects parameter 1 to be string, array given in .../administrator/components/com_civicrm/civicrm/packages/HTML/Common.php on line 144 under Joomla and CiviCRM 5.11.0 when running Event Reports -> Attendee List. There is no longer a Joomla demo site it seems, so cannot reproduce there. It seems linked to an empty custom field value, but I'm not sure which one.
A workaround is to test for the value type before attempting to call htmlspecialchars:
if (is_array($value)) {
if (count($value) == 0) {
$value1 = ''; // an empty string
$strAttr .= ' ' . $key . '="' . htmlspecialchars($value1, ENT_COMPAT, $charset) . '"';
}
else {
foreach ($value as $value1) {
$strAttr .= ' ' . $key . '="' . htmlspecialchars($value1, ENT_COMPAT, $charset) . '"';
}
}
}
else {
$strAttr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_COMPAT, $charset) . '"';
}
}
Has anyone any comments?