The dedupe function does not properly detect duplicates when used on a field value that is falsy, e.g. `0`.
As a result, PDOExceptions may occur due to duplicate keys:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'sku': INSERT INTO {commerce_product} (revision_id, sku, title, type, language, uid, status, created, changed) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( /* MYDATA */ ) in drupal_write_record() (Zeile 7333 von /srv/www/htdocs/MYPROJECT/html/includes/common.inc).
Comment | File | Size | Author |
---|---|---|---|
#6 | migrate-2630862-6.patch | 739 bytes | pifagor |
|
Comments
Comment #2
ckaotikAttached patch to replace `fetchField()` with `rowCount() > 0`. Also removed `$candidate_found` assignment since it was not used anywhere else.
Comment #3
ckaotikComment #4
joelpittetThat's a good call! RTBC++. It doesn't apply against dev but it's only 2 lines
Comment #6
pifagorI recreated patch.
Comment #7
pifagorComment #8
alex_optimPatch good work for me.
Comment #9
pifagorComment #11
pifagor