Uncaught TypeError: Return value of CRM_Contact_Import_Form_MapField::getLocationTypeLabel() must be of the type string, null returned
Overview
WordPress contacts import from CSV, CiviCRM 5.61.2. (not reproduceable on dmaster). https://civicrm.stackexchange.com/questions/45332/contacts-import-issue-at-crm-contact-import-form-mapfieldgetlocationtypelabel
Reproduction steps
- Click on Contacts -> Import Contacts.
- Add a CSV file, leave all settings intact and click Continue.
- Got a Wordpress WSOD and php error log message "Uncaught TypeError: Return value of CRM_Contact_Import_Form_MapField::getLocationTypeLabel() must be of the type string, null returned in /data/sites/web/pedesdev/www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Import/Form/MapField.php:480".
Expected behaviour
Process to the next import step
Environment information
- CiviCRM: 5.61.2
- PHP: 7.4.3
Comments
Fixed by changing from
- protected function getLocationTypeLabel($type): string {
to
- protected function getLocationTypeLabel($type): ?string {
in www/wp-content/plugins/civicrm/civicrm/CRM/Contact/Import/Form/MapField.php:480
however not sure if this is the right way.