Merge Contacts Uncaught TypeError: strlen()

Hi,

When i try to merge contacts i get this error - how can i tweak this so it works? :slight_smile:

I’ve looked at a few posts, checked file permissions, php version seems to match up with the version i have installed.

Any help would be magical :heart: Been using Suite for some time now and managed to do some awesome stuff with (it’s so flexible!) :slight_smile: Thanks all.

Fatal error : Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, array given in /homepages/34/d914923889/htdocs/pfg/casemgr/include/database/DBManager.php:2082 Stack trace:
#0 /homepages/34/d914923889/htdocs/pfg/casemgr/include/database/DBManager.php(596): DBManager->updateSQL(Object(Contact), Array)
#1 /homepages/34/d914923889/htdocs/pfg/casemgr/data/SugarBean.php(2408): DBManager->update(Object(Contact))
#2 /homepages/34/d914923889/htdocs/pfg/casemgr/include/SugarObjects/templates/person/Person.php(210): SugarBean->save(NULL)
#3 /homepages/34/d914923889/htdocs/pfg/casemgr/modules/MergeRecords/SaveMerge.php(113): Person->save(NULL)
#4 /homepages/34/d914923889/htdocs/pfg/casemgr/include/MVC/View/SugarView.php(823): include_once(’/homepages/34/d…’)
#5 /homepages/34/d914923889/htdocs/pfg/casemgr/include/MVC/View/views/view.classic.php(72): SugarView->includeClassicFile(‘modules/MergeRe…’)
#6 /homepages/34/d914923889/htdocs/pfg/casemgr/include/MVC/View/SugarView.php(210): ViewClassic->display()
#7 /homepages/34/d914923889/htdocs/pfg/casemgr/include/MVC/Controller/SugarController.php(432): SugarView->process()
#8 /homepages/34/d914923889/htdocs/pfg/casemgr/include/MVC/Controller/SugarController.php(363): SugarController->processView()
#9 /homepages/34/d914923889/htdocs/pfg/casemgr/include/MVC/SugarApplication.php(101): SugarController->execute()
#10 /homepages/34/d914923889/htdocs/pfg/casemgr/index.php(52): SugarApplication->execute()
#11 {main} thrown in /homepages/34/d914923889/htdocs/pfg/casemgr/include/database/DBManager.php on line 2082

One of your fields contains an array, for some reason. Have you tweaked field types or used any strange kind of field customization?

If you can add some logging right before the strlen in include/database/DBManager.php:2082, you can focus better on the problematic field.

Add something like

$GLOBALS['log']->fatal('fieldDef:' . print_r($fieldDef, true));

This is what I got after popping that into just before the strlen

I’ve taken a long look through and can’t see anything glaringly obvious - The only thing I spotted potentially was the merge filter on mobile field is disabled

Fri Aug 12 12:34:51 2022 [63705][1][FATAL] Mysqli_query failed.
Fri Aug 12 12:34:51 2022 [63705][1][FATAL] Query Failed: UPDATE contacts_cstm SET jjwg_maps_lng_c=0.00000000 ,jjwg_maps_lat_c=0.00000000 ,jjwg_maps_geocode_status_c=’’ ,jjwg_maps_address_c=’’ ,referral_c=‘Anxiety /Depression, Bereavement’ ,referraldate_c=‘2021-12-30’ ,interventions_c=’’ ,suicidehiu_c=‘HIU’ ,uid_c=‘1011’ ,services_c=’’ ,support_area_c=’’ ,ext_agent_c=’’ ,ext_phn_c=’’ WHERE id_c=‘a822bc37-ce37-4aa6-9b34-622f6895abd4’: MySQL error 1054: Unknown column ‘services_c’ in ‘field list’
Fri Aug 12 12:41:07 2022 [18511][1][FATAL] Mysqli_query failed.
Fri Aug 12 12:41:07 2022 [18511][1][FATAL] Query Failed: UPDATE contacts_cstm SET jjwg_maps_lng_c=0.00000000 ,jjwg_maps_lat_c=0.00000000 ,jjwg_maps_geocode_status_c=’’ ,jjwg_maps_address_c=’’ ,referral_c=‘Anxiety /Depression, Bereavement’ ,referraldate_c=‘2021-12-30’ ,interventions_c=’’ ,suicidehiu_c=‘HIU’ ,uid_c=‘1011’ ,services_c=’’ ,support_area_c=’’ ,ext_agent_c=’’ ,ext_phn_c=’’ WHERE id_c=‘a822bc37-ce37-4aa6-9b34-622f6895abd4’: MySQL error 1054: Unknown column ‘services_c’ in ‘field list’
Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => date_modified
[vname] => LBL_DATE_MODIFIED
[type] => datetime
[group] => modified_by_name
[comment] => Date record last modified
[enable_range_search] => 1
[options] => date_range_search_dom
[inline_edit] =>
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => modified_user_id
[rname] => user_name
[id_name] => modified_user_id
[vname] => LBL_MODIFIED
[type] => assigned_user_name
[table] => users
[isnull] => false
[group] => modified_by_name
[dbType] => id
[reportable] => 1
[comment] => User who last modified record
[massupdate] =>
[inline_edit] =>
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => created_by
[rname] => user_name
[id_name] => modified_user_id
[vname] => LBL_CREATED
[type] => assigned_user_name
[table] => users
[isnull] => false
[dbType] => id
[group] => created_by_name
[comment] => User who created record
[massupdate] =>
[inline_edit] =>
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => description
[vname] => LBL_DESCRIPTION
[type] => text
[comment] => Full text of the note
[rows] => 6
[cols] => 80
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => assigned_user_id
[rname] => user_name
[id_name] => assigned_user_id
[vname] => LBL_ASSIGNED_TO_ID
[group] => assigned_user_name
[type] => relate
[table] => users
[module] => Users
[reportable] => 1
[isnull] => false
[dbType] => id
[audited] => 1
[comment] => User ID assigned to record
[duplicate_merge] => disabled
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => salutation
[vname] => LBL_SALUTATION
[type] => enum
[options] => salutation_dom
[massupdate] =>
[len] => 255
[comment] => Contact salutation (e.g., Mr, Ms)
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => first_name
[vname] => LBL_FIRST_NAME
[type] => varchar
[len] => 100
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 3
)

[comment] => First name of the contact
[merge_filter] => selected

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => last_name
[vname] => LBL_LAST_NAME
[type] => varchar
[len] => 100
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 3
)

[comment] => Last name of the contact
[merge_filter] => selected
[required] => 1
[importable] => required

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => title
[vname] => LBL_TITLE
[type] => varchar
[len] => 100
[comment] => The title of the contact
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => photo
[vname] => LBL_PHOTO
[type] => image
[massupdate] =>
[comments] =>
[help] =>
[importable] =>
[reportable] => 1
[len] => 255
[dbType] => varchar
[width] => 160
[height] => 160
[studio] => Array
(
[listview] => 1
)

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => department
[vname] => LBL_DEPARTMENT
[type] => varchar
[len] => 255
[comment] => The department of the contact
[merge_filter] => enabled
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => do_not_call
[vname] => LBL_DO_NOT_CALL
[type] => bool
[default] => 0
[audited] => 1
[comment] => An indicator of whether contact can be called
)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => phone_home
[vname] => LBL_HOME_PHONE
[type] => phone
[dbType] => varchar
[len] => 100
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 1
)

[comment] => Home phone number of the contact
[merge_filter] => enabled

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => phone_mobile
[vname] => LBL_MOBILE_PHONE
[type] => phone
[dbType] => varchar
[len] => 100
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 1
)

[comment] => Mobile phone number of the contact
[merge_filter] => disabled
[required] => 1
[inline_edit] => 1
[comments] => Mobile phone number of the contact

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => phone_work
[vname] => LBL_OFFICE_PHONE
[type] => phone
[dbType] => varchar
[len] => 100
[audited] => 1
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 1
)

[comment] => Work phone number of the contact
[merge_filter] => enabled

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => phone_other
[vname] => LBL_OTHER_PHONE
[type] => phone
[dbType] => varchar
[len] => 100
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 1
)

[comment] => Other phone number for the contact
[merge_filter] => enabled

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => phone_fax
[vname] => LBL_FAX_PHONE
[type] => phone
[dbType] => varchar
[len] => 100
[unified_search] => 1
[full_text_search] => Array
(
[boost] => 1
)

[comment] => Contact fax number
[merge_filter] => enabled

)

Fri Aug 12 12:41:07 2022 [18511][1][FATAL] fieldDef:Array
(
[name] => lawful_basis
[vname] => LBL_LAWFUL_BASIS
[type] => multienum
[massupdate] => 1
[no_default] =>
[comments] =>
[inline_edit] => 1
[reportable] => 1
[merge_filter] => enabled
[len] => 100
[size] => 20
[options] => lawful_basis_dom
[audited] => 1
[importable] => 1
)

This advice led me straight to it :slight_smile: - many thanks pgr :slight_smile:

1 Like