Unverified Commit 72f72900 authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub

Merge pull request #16876 from colemanw/ssFix

Fix undefined index warning in SavedSearch api
parents 27a591ca db2d6c10
......@@ -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']);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment