In this module's hook_field_attach_submit implementation, a fields value will get set to an empty array if $entity_ids is empty (example value: $entity->field['und'] = array()). This causes problems when other modules check the field value using empty(). We should do an empty check on the $entity_ids array before setting the field value via the wrapper.

I came across this issue when building a commerce license project. During commerce_cart_add_to_cart_form_submit(), field_attach_submit() is called which set the commerce_license field on my line item to an empty value. Then when commerce_license_commerce_line_item_presave() hook was triggered, the empty($line_item->commerce_license) was providing a false result and the license wouldn't be created. The attached patch fixes this issue.

Comments

andyg5000’s picture

Status: Active » Needs review
bojanz’s picture

Status: Needs review » Fixed

Good catch.
Committed, thanks!

Status: Fixed » Closed (fixed)

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