Import with custom fields fails due to email normalization
-
When importing users with custom field data, the import fails due to SQL validation errors when trying to insert null values.
The underlying cause is the mechanism by which the importer tries to associate imported subscriber data by index keyed on the email address in lib/Subscribers/ImportExport/Import/Import.php in the method
createOrUpdateCustomFields()
.Elsewhere in the import process, emails are normalized to lowercase, but the value used on in
$created_or_updated_subscriber['email']
on this line reflects the original value, which may be upper or lowercase:$subscriber_index = $subscribers_emails[$created_or_updated_subscriber['email']];
This results in a null values for
$subscriber_index
and subsequent access to$values[$existing_subscriber_key]
. The SQL failure occurs from an attempt to insert these null values.Wrapping
strtolower()
seemed to fix the issue, though there’s likely a more appropriate time to convert this data:$subscriber_index = $subscribers_emails[strtolower($created_or_updated_subscriber['email'])];
- The topic ‘Import with custom fields fails due to email normalization’ is closed to new replies.