Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::onDependencyRemoval()
sets $handler_settings['auto_create'] = NULL;
but auto_create is defined as a Boolean in config schema - see entity_reference_selection.default
in core/config/schema/core.data_types.schema.yml
Discovered as part of #2742585: Deprecate dangerous assertTrue/False() compatibility overrides in PHPUnit Kernel, Functional and FunctionalJavascript tests
Proposed resolution
Change the code to set it to FALSE
Remaining tasks
Determine why schema is not being enforced on config save. see #3.
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
N/a
Comment | File | Size | Author |
---|---|---|---|
#9 | 3082289-9.patch | 1.78 KB | Krzysztof Domański |
#9 | 3082289-9-test-only.patch | 879 bytes | Krzysztof Domański |
#9 | interdiff-2-9.txt | 1.54 KB | Krzysztof Domański |
#2 | 3082289-2.patch | 3.35 KB | alexpott |
#2 | 3082289-2-test-only.patch | 2.42 KB | alexpott |
Comments
Comment #2
alexpottComment #3
alexpottSo the reason that this is not casted to a Boolean is that we have special logic around null values \Drupal\Core\Config\StorableConfigBase::castValue() in specifically:
So we leave nulls alone. This is a much much wider issue if we want to fix that. I think the current small fix is okay but I'll check for follow-ups about this wider issue of config and nulls. Config schema does have the concept of
nullable
but funnily enough this is only really supported by sequences and mapping types - even if there places in core where people have added it to scalars.Comment #4
alexpottComment #6
mondrakeDo we need @todos to revert this to assertTrue and assertFalse in #2742585: Deprecate dangerous assertTrue/False() compatibility overrides in PHPUnit Kernel, Functional and FunctionalJavascript tests? Other than that, RTBC I'd say
Comment #7
mondrake#6 not necessary, will be done in a bulky way later.
Comment #8
mondrakeCritical as it is holding the Critical parent
Comment #9
Krzysztof Domański1. The patch contained code from another issue #3082287: \Drupal\user\Plugin\views\access\Role::access() does not conform to the base class documentation. I deleted it.
2. Follow-up for #6: #3082415: Replace assert(Not)Same/Identical() on booleans with assert(Not)True/False() in PHPUnit tests.
3. Needs follow-up for #3.
Comment #11
alexpottwhoops... @Krzysztof Domański thanks for tidying that up!
Comment #14
catchCommitted 9af697c and pushed to 8.8.x. Thanks!
Comment #15
jibran