but because external_identifier is not available inside the response coming from getfields API call on the address entity (given it is not part of the Address entity), the first argument to the array_merge will be NULL, which on PHP 7 sites will just throw a warning, but on PHP 8 sites it fails with the following error:
array_merge(): Argument #1 must be of type array, null given in array_merge() (line 126 of /var/www/default/htdocs/httpdocs/profiles/devprofile/modules/contrib/civicrm/ext/nz.co.fuzion.csvimport/CRM/Csvimport/Import/Parser/Api.php)
Before
Unable to import addresses on PHP 8 sites, where it fails on the fields mapping page:
After
address import works fine
Technical notes
The address
external_identifier
is a special case field and not part of the address entity, : https://github.com/omarabuhussein/nz.co.fuzion.csvimport/blob/e5f0c93d02c81b29406527e88ebb996dd3abc8c3/CRM/Csvimport/Import/Parser/Api.php#L269but the
getReferenceFields
method uses the APIgetfields
action to get the Address entity fields meta data, then tries to to look for theexternal_identifier
in there and then it tires to merge it with some other meta data (using array_merge) : https://github.com/omarabuhussein/nz.co.fuzion.csvimport/blob/e5f0c93d02c81b29406527e88ebb996dd3abc8c3/CRM/Csvimport/Import/Parser/Api.php#L135-L142but because
external_identifier
is not available inside the response coming fromgetfields
API call on the address entity (given it is not part of the Address entity), the first argument to the array_merge will be NULL, which on PHP 7 sites will just throw a warning, but on PHP 8 sites it fails with the following error: