field_info_extra_fields() is not language-aware, may return wrong values

Created on 11 October 2012, over 12 years ago
Updated 24 May 2024, 9 months ago

I came I came across the issue Product label translations show up in incorrect language on a Drupal commerce site.

I tracked down the problem to the function field_info_extra_fields() and the FieldInfo class.
The problem is that the method FieldInfo::getBundleExtraFields() calls $extra = module_invoke_all('field_extra_fields'); and in turn hook_field_extra_fields() is called returning localized data however.
The extra field info is then cached into the cache_field table as 'field_info:bundle_extra': cache_set("field_info:bundle_extra:$entity_type:$bundle", $info, 'cache_field');.

This leads to one language getting stuck in cache and showing for all other languages

🐛 Bug report
Status

RTBC

Version

7.0 ⚰️

Component
Field 

Last updated about 1 hour ago

Created by

🇬🇧United Kingdom guy_schneerson

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024