Closed (outdated)
Project:
Drupal core
Version:
8.5.x-dev
Component:
options.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Sep 2016 at 13:26 UTC
Updated:
14 Feb 2018 at 18:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
br0kenLet's start from tests, which should fail.
Comment #4
br0kenPossible fix.
Comment #5
valthebaldNeeds tests, if this is a new bug
Comment #6
br0kenComment #7
valthebaldSorry, missed that the patch already contains a test
Comment #8
gaydamaka commentedPatch #4 solve the issue with re-importing
optionfield with a list of allowed values.Comment #9
br0kenWhen the field already in use and has a set of allowed values then reimporting will lead to fail inside of
options_field_storage_config_update_forbid()function because structures of compared items could differ. For instance:Comment #10
br0kenComment #12
br0kenComment #14
br0kenComment #15
gaydamaka commentedComment #17
br0kenBack RTBC since tests were passed.
Comment #18
alexpottThis is not actually used in code.
This looks super weird.
This should be a fully qualified class name.
The expectation that array passed to create and the stored array in configuration is the same is the problem here. I can see why it exists and it seems sensible but it's not the current behaviour - which we still need to support - otherwise this is an API change.
Comment #19
br0kenstorageSettingsToConfigData,storageSettingsFromConfigDataetc.)usestatements?Comment #20
br0kenComment #21
br0ken@alexpott, please, take some time on this.
Comment #24
dangur commentedPHPUnit tests are failing with
when I attempt to add additional fields to a custom entity that has list values. The issue seems similar enough to this one to add it here instead of making a new issue. Test passes with this patch.
Comment #26
alexpottRe #19 1 and 3 - @BR0kEN our code standards are for fully qualified classnames. And no we don't support use statements just for stuff in documentation.
Re #19 2 - The reason for storageSettingsToConfigData and storageSettingsFromConfigData is because the structure of the options allowed values at runtime can not be stored in YAML files without corruption so we need to change it. YAML is specific about what can go into keys.
Re #19 4 - this is kinda the same as point 2. The values in config don't map exactly to the values on the entity. The assumption that you can read values from configuration and use them to create an entity is not correct.
These are unrelated changes not necessary to fix the bug.
Comment #27
br0kenRe-roll for
8.5.x.Comment #28
br0kenLet's try with tests only.
Comment #30
br0kenAs expected.
Comment #31
lpeabody commentedI can confirm this is a bug, and it becomes especially prevalent when using a Features configuration management strategy. Reverting a field storage object for a list field results in this error. I've applied the patch in #27 and the revert works as expected.
Reviewed against core 8.3.7.
Comment #32
br0ken@alexpott #18.2, regarding super weird lines:
$this->settingsbefore the processing have the following structure:The
$field_item_class::storageSettingsToConfigData()and$field_item_class::storageSettingsFromConfigData()helps to restructure settings into a correct format:An underlying issue is, probably, somewhere deeper but the patch is still working.
Comment #33
alexpottThis is not how it is supposed to be done. There is a method on the storage called
createFromStorageRecordand guessing by #31 features is not using it.Comment #34
br0kenUsing the
createFromStorageRecord()orupdateFromStorageRecord()I couldn't confirm the problem. Probably it's exists before 8.5.x. Needs more investigations.Comment #35
br0kenAfter checking latest codebases at 8.3.x, 8.4.x and 8.5.x I wasn't able to reproduce the behavior.
Comment #36
jasonawantAdding related issue > https://www.drupal.org/project/drupal/issues/2944144