Thanks for working on this.
Our format actually includes the value separator on the outside of the items as well (so if the separator character was * it would look like *1*2*3*)
I think instead of doing this you can unconditionally pass the param into CRM_Utils_Array::implodePadded since it is smart enough to handle array or string input.
so you can just do `$params['role_id'] = CRM_Utils_Array::implodePadded($params['role_id']);`