Boolean custom values can't be of type boolean
The CustomValue APIv4 fails if you pass in a boolean with a value of
- Create a multi-record custom field set.
- Create a boolean custom field.
- Try writing to that custom field with a value of
FALSE. Note that this isn't possible with API Explorer, because that will pass the string
Error value: is not of the right field data type: Boolean
Value saves correctly.
This happens because
CRM_Utils_Type::escape() does a
preg_replace on Boolean fields, assuming they're strings. And on APIv3, that would be correct. On APIv4 we can pass an actual Boolean, which fails because it can't be parsed as a string.
I'm not sure if this belongs more appropriately in
CRM_Utils_Rule::boolean(). I'll let more knowledgeable folks bikeshed that.