I've run into an issue where saving a node form with an empty Xero reference (Xero autocomplete widget) results in a fatal.

field.default.inc (line 38) calls drupal_array_get_nested_value() to get the value of a field and is expected to return an array. On line 41 an unset is called on the expectant array and the fatal occurs if the result was not an array.

In xero_field_autocomplete_validate(), if no value is provided in the field, then null is returned instead of an empty array - this results in the fatal. Solution appears to be return an empty array instead of null.

Patch below.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Feng-Shui’s picture

Attached patch resolves the issue for me. Thanks for the module, it's been great so far!

mradcliffe’s picture

Status: Active » Needs review

Thanks for the patch (and the other patch). I meant to apply and review it this week, but I need to shift back to Core development for a bit.

At a brief glance, I thought this patch made sense.

mradcliffe’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs review » Fixed

Committed to 7.x-1.x.

  • mradcliffe committed 760c612 on 7.x-1.x authored by Feng-Shui
    Issue #2424081 by Feng-Shui: Fix cannot unset string offsets in field....

Status: Fixed » Closed (fixed)

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