Skip to content

Commit

Permalink
Merge pull request #16884 from civicrm/5.24
Browse files Browse the repository at this point in the history
5.24
  • Loading branch information
colemanw authored Mar 24, 2020
2 parents 6b9010c + 72f7290 commit a61efd0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions api/v3/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,19 @@ function civicrm_api3_saved_search_get($params) {
}

/**
* This function unserializes the form_values in an SavedSearch API result.
* Unserialize the form_values field in SavedSearch API results.
*
* Note: APIv4 handles serialization automatically based on metadata.
*
* @param array $result API result to be cleaned up.
*/
function _civicrm_api3_saved_search_result_cleanup(&$result) {
if (isset($result['values']) && is_array($result['values'])) {
// Only clean up the values if there are values. (A getCount operation
// for example does not return values.)
// Only run if there are values (getCount for example does not return values).
foreach ($result['values'] as $key => $value) {
$result['values'][$key]['form_values'] = \CRM_Utils_String::unserialize($value['form_values']);
if (isset($value['form_values'])) {
$result['values'][$key]['form_values'] = CRM_Utils_String::unserialize($value['form_values']);
}
}
}
}

0 comments on commit a61efd0

Please sign in to comment.