• 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'])];
    
    • This topic was modified 6 years, 3 months ago by deltafactory. Reason: code formatting
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thanks for the feedback @deltafactory, we’ll look into it.

    Thread Starter deltafactory

    (@deltafactory)

    Hi @wysija,

    I just tested the latest version which supposedly addresses the issue. I am still seeing the error. Not sure if this affects your test scenario, but it only occurs under the method to update custom fields, not the core first/last name and email.

    Thread Starter deltafactory

    (@deltafactory)

    I see that the new release normalizes the emails through validateSubscribersData() however when checking for existing users, the email value from the database is the one used via this call on line 376:

    Subscriber::selectMany(array('id', 'email'))->whereIn('email', $data)->findArray()

    The strtolower() call needs to happen after that point, closer to when the email value is used as an array key.

    Thanks for your continued effort to address this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Import with custom fields fails due to email normalization’ is closed to new replies.