CRM-17208, moved $params before pre hook so that it can be altered in…
*/
function civicrm_api3_membership_type_get($params) {
$results = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
- if (!empty($results['values'])) {
+ if (!empty($results['values']) && is_array($results['values'])) {
foreach ($results['values'] as &$item) {
// Workaround for fields using nonstandard serialization
foreach (array('relationship_type_id', 'relationship_direction') as $field) {
case CRM_Utils_Type::T_LONGTEXT:
case CRM_Utils_Type::T_EMAIL:
$entity[$fieldName] = substr('New String', 0, CRM_Utils_Array::Value('maxlength', $specs, 100));
+ // typecast with array to satisfy changes made in CRM-13160
+ if ($entityName == 'MembershipType' && in_array($fieldName, array('relationship_type_id', 'relationship_direction'))) {
+ $entity[$fieldName] = (array) $entity[$fieldName];
+ }
break;
case CRM_Utils_Type::T_INT: