Fatal error when trying to delete an existing Custom Field, error message: Expected one CustomField but found XX
Fatal error when trying to delete an existing Custom Field, error message: Expected one CustomField but found XX.
Steps to reproduce
- Create custom fieldset for Individual Contact, fieldset A
- Create custom field B
- Delete custom field B
- Fatal error raised. Field B is not deleted
Workaround has been to disable this extension.
Environments
- CiviCRM 5.49.1, CiviCRM 5.53.0
- Tested using optionsimporter versions: 2.0, 2.1 and 2.x
Error backtrace
Sep 09 17:29:54 [error]
$Fatal Error Details = array:3 [
"message" => "Expected one CustomField but found 17"
"code" => null
"exception" => CRM_Core_Exception {#15555
-errorData: array:4 [
"count" => 17
"is_error" => 1
"error_message" => "Expected one CustomField but found 17"
"error_code" => "undefined"
]
#cause: null
-_trace: null
#message: "Expected one CustomField but found 17"
#code: 0
#file: "/var/www/httpdocs/wp-content/plugins/civicrm/civicrm/api/api.php"
#line: 135
trace: {
/var/www/httpdocs/wp-content/plugins/civicrm/civicrm/api/api.php:135 {
› if (is_array($result) && !empty($result['is_error'])) {
› throw new CiviCRM_API3_Exception($result['error_message'], CRM_Utils_Array::value('error_code', $result, 'undefined'), $result);
› }
}
/var/www/httpdocs/wp-content/plugins/civicrm/civicrm/ext/com.ixiam.optionsimporter/CRM/Optionsimporter/Page/DeleteImporter.php:14 { ...}
/var/www/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319 { ...}
/var/www/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69 { ...}
/var/www/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36 { ...}
/var/www/httpdocs/wp-content/plugins/civicrm/civicrm.php:1200 { ...}
/var/www/httpdocs/wp-includes/class-wp-hook.php:307 { ...}
/var/www/httpdocs/wp-includes/class-wp-hook.php:331 { ...}
/var/www/httpdocs/wp-includes/plugin.php:476 { ...}
/var/www/httpdocs/wp-admin/admin.php:259 { ...}
}
}
]
Sep 09 17:29:54 [debug] $backTrace = #0 /var/www/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(443): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(39): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
#2 /var/www/httpdocs/wp-content/plugins/civicrm/civicrm.php(1200): CRM_Core_Invoke::invoke((Array:6))
#3 /var/www/httpdocs/wp-includes/class-wp-hook.php(307): CiviCRM_For_WordPress->invoke("")
#4 /var/www/httpdocs/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters("", (Array:1))
#5 /var/www/httpdocs/wp-includes/plugin.php(476): WP_Hook->do_action((Array:1))
#6 /var/www/httpdocs/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
#7 {main}
Agileware ref: CIVICRM-2039
Edited by justinfreeman (Agileware)