Skip to content
Snippets Groups Projects
Commit b026ac81 authored by eileen's avatar eileen
Browse files

#562 remove calls to dao->free() from api folder

Per gitlab

The DAO object since ? 4.7.x? has been freed on _destruct. Using the ->free action has been demonstrated to create some rare bugs - ie. because query sets from the outer loop can be lost. There is no benefit in calling it any more and some harm

https://github.com/civicrm/civicrm-core/pull/13192 was the last one in this series
parent aaa8f311
Branches
Tags
No related merge requests found
......@@ -105,9 +105,6 @@ function civicrm_api3_activity_create($params) {
$activityDAO->id = $params['id'];
$activityDAO->is_current_revision = 0;
if (!$activityDAO->save()) {
if (is_object($activityDAO)) {
$activityDAO->free();
}
throw new API_Exception(ts("Unable to revision existing case activity."));
}
$createRevision = TRUE;
......
......@@ -655,7 +655,6 @@ function civicrm_api3_mailing_send_test($params) {
'email_id' => $dao->id,
);
}
$dao->free();
foreach ($testEmailParams['emails'] as $key => $email) {
$email = trim($email);
$contactId = $emailId = NULL;
......
......@@ -173,10 +173,8 @@ SELECT start_date, end_date, join_date, membership_type_id
}
}
else {
$dao->free();
throw new API_Exception('did not find a membership record');
}
$dao->free();
return $result;
}
......
......@@ -218,9 +218,6 @@ function civicrm_api3_create_success($values = 1, $params = array(), $entity = N
$result['undefined_fields'] = array_merge($undefined);
}
}
if (is_object($dao)) {
$dao->free();
}
$result['version'] = 3;
if (is_array($values)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment