Entity Metadata Wrappers doesn't set correctly the value when the entity is translatable, and the field is not.

Created on 30 April 2016, over 8 years ago
Updated 28 January 2023, almost 2 years ago

I found a issue in field langcode when I am usign Entity Metadata Wrappers of the Entity API Module.

The problem occurs when the entity is translatable and the field is not translatable, I try to set the date to the field and it change the value to entity langcode:

// $entity is "en"
// Field is not translatable, it should be "und"

$entity->field_date->set($date);

// Result:
// $entity->field_date['en'][0]['value'] = $date;

This is happening because of the function: date_entity_metadata_field_setter() in date.module line 676. The module doesn't check if the langcode passed is acceptable to the field.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇧🇷Brazil extqy

Live updates comments and jobs are added and updated live.
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