Fixed Banning an email throws error when the administrator attempts to re-add it by using a modified case

alexD

Well-known member
Affected version
2.0.2
Reasoning:
https://xenforo.com/community/resou...mail-hosts.5939/reviews#resource-review-16850
The import of new records stops when a mismatched-case, duplicate value is inserted. All other records up to this point get inserted.

A quick fix for the affected user would be to use the following two queries:
SQL:
UPDATE xf_ban_email SET banned_email = LOWER(banned_email);

UPDATE xf_data_registry SET data_value = LOWER(CONVERT(BINARY data_value USING utf8)) WHERE data_key = 'bannedEmails';

Reproduce:
Ban email: *@aa.test
Ban email: *@aa.test (ok, remains unchanged)
Ban email: *@aA.test (throws error)

The check that happens on the registry bannedEmails array is case sensitive.
 
Certainly anything like that halting the import process isn't ideal. There was code to detect duplicates and skip them, but as you say, it was case sensitive so iit wasn't working as expected.

The import service now uses array_map to make all cache values lower case for the purpose of checking, and similarly we lower case the entry being checked, too, so duplicates of different cases won't give that error anymore.
 
Back
Top Bottom