Details
Description
When creating a new custom field, and adding options after the field has been created, civicrm escapes the string twice, causing an SQL error.
How to reproduce:
- create a custom field, type Integer, widget Select
- add an option for the field, save
- go back to the management of the field options, add a new one:
- Label: L'été
- Value: 123 (doesn't matter)
Saving will cause an SQL error.
I isolated the code to: civicrm/CRM/Custom/Form/Option.php formRule()
$optionLabel = CRM_Utils_Type::escape($fields['label'], 'String');
$optionValue = CRM_Utils_Type::escape($fields['value'], 'String');
I don't think it is necessary to escape() the strings here, because the DB calls later pass the params as 'string':
$params = array(
1 => array($optionGroupId, 'Integer'),
2 => array($optionLabel, 'String'),
);