Bean invokes field_attach_form_validate() to validate its fields, but doesn't pass the language code to it. This doesn't cause any problems on mono-lingual sites.

But on multi-lingual sites it causes the field module to validate all language versions of the field (when using field translation). And that can in some cases cause the following error if the values from other languages fail validation:

Error message
Notice: Undefined index: array_parents in field_default_form_errors() (line 394 of /data/xxxx/www/modules/field/field.form.inc).
Recoverable fatal error: Argument 2 passed to drupal_array_get_nested_value() must be an array, null given, called in /data/xxxx/www/modules/field/field.form.inc on line 394 and defined in drupal_array_get_nested_value() (line 6787 of /data/xxxx/www/includes/common.inc).

I found that it doesn't happen with all types of fields. But I had the issue with Link module.

So here's how to replicate:
1- Create a Bean type with a Link field (using the Link module) with field translation enabled.
2- Create a Bean with a valid value in the Link field (linking to a node).
3- Create a translation of that bean in another language on the site (let's say now we have English - the default language of the site- and French).
4- Delete the node (which would make the URLs invalid in both the English and French version)
5- Now got an edit the French version. Any attempt to save will result in the error above.

Passing the $langcode to the function fixes it all. (patch to follow in a comment).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

khaled.zaidan created an issue. See original summary.

khaled.zaidan’s picture

Status: Active » Needs review
FileSize
497 bytes

Patch (attached, against dev version) is quite simple really!

I hope someone has a look at it and approves or improves :)

khaled.zaidan’s picture

Sorry, ignore the previous patch.

New (correct) patch attached.

Andy Inman’s picture

+1 for patch #3. Had the same error as reported here, the patch made it go away and block now appears to save correctly. Prior to applying the patch, the reported error was shown and changes made in the edit form were lost.

The patch seems to work fine with both the current dev version and the current release 7.x-1.11.

nileema.jadhav’s picture

Status: Needs review » Reviewed & tested by the community

I am also facing the above error for link fields having translations enabled. Patch #3 worked for me. And yes, patch works fine with both the current dev version and the current release 7.x-1.11.