[#25] Only json_decode() custom_fields parameter if it's a string.
This commit is contained in:
parent
20ab34e338
commit
e57e50f496
1 changed files with 4 additions and 1 deletions
|
@ -107,7 +107,10 @@ class CRM_Twingle_Submission {
|
||||||
|
|
||||||
// Validate custom fields parameter, if given.
|
// Validate custom fields parameter, if given.
|
||||||
if (!empty($params['custom_fields'])) {
|
if (!empty($params['custom_fields'])) {
|
||||||
if (!is_array($custom_fields = json_decode($params['custom_fields'], TRUE))) {
|
if (is_string($params['custom_fields'])) {
|
||||||
|
$params['custom_fields'] = json_decode($params['custom_fields'], TRUE);
|
||||||
|
}
|
||||||
|
if (!is_array($params['custom_fields'])) {
|
||||||
throw new CiviCRM_API3_Exception(
|
throw new CiviCRM_API3_Exception(
|
||||||
E::ts('Invalid format for custom fields.'),
|
E::ts('Invalid format for custom fields.'),
|
||||||
'invalid_format'
|
'invalid_format'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue