node_convert_field_convert uses field_get_items to retrieves values.
Anyway field_get_items can return FALSE (when the field is an empty array).
A typical case is an optional term reference where "no value" means not even a [LANGUAGE_NONE] indexed array, the field is only an empty array.
In such a case, we don't want to artificially create index because chances are that they will be populated in unpredictable (and buggy way) (at least in ways that I don't understand).

In the taxonomy example, you will end up with ["und"][0]["tid"] => NULL but it's wrong, and the taxonomy module will then complain about Integrity constraint violation: 1048 Column tid cannot be null

The attached patch may solve this problem but it needs understanding (and probably testing too).

CommentFileSizeAuthor
#1 1454128-convert-empty-terms.patch876 bytesdrzraf

Comments

drzraf’s picture

StatusFileSize
new876 bytes
alcroito’s picture

Status: Active » Fixed

Yep, totally makes sense to handle FALSE values gracefully. Thanks for the patch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.