- Issue created by @wim leers
- Assigned to wim leers
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 2:37pm 17 May 2023 - last update
over 1 year ago 29,386 pass, 1 fail - last update
over 1 year ago 29,388 pass - š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
Discovered this in āØ Expose validation constraints (and validatability %) in Config Inspector UI Fixed and hence had to work around this.
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
How the hell did you run into this?
I worked around it in contrib like this:
/** * Work-around for bug introduced in #2361539. * * @see \Drupal\Core\TypedData\ListDataDefinition::getDataType() * @see \Drupal\Core\Config\Schema\SequenceDataDefinition * @see https://www.drupal.org/project/drupal/issues/2361539 * @todo Remove this when this module requires a Drupal core version that includes https://www.drupal.org/project/drupal/issues/3361034. */ protected static function getDataType(TypedDataInterface $typed_data) : string { $data_type = $typed_data->getDataDefinition()->getDataType(); if ($data_type === 'list') { $data_type = 'sequence'; } return $data_type; }
ā¦ because without this, it's impossible to correctly traverse a typed data tree by using the return value of
$typed_data->getDataDefinition()->getDataType()
ā¦ sincelist
is not actually a config schema type,\Drupal\Core\Config\TypedConfigManager::determineType()
decides to make it automagically fall back to theundefined
type š³ā¦ at which point traversing further down the three of course is impossible.
Why can this go undiscovered for a decade?
The reason this has not caused problems for Drupal core so far is that
\Drupal\Core\TypedData\Validation\RecursiveContextualValidator::validateNode()
does not use the full config schema tree, but instead relies on inspecting the typed data's object instances:// If the data is a list or complex data, validate the contained list items // or properties. However, do not recurse if the data is empty. // Next, we do not recurse if given constraints are validated against an // entity, since we should determine whether the entity matches the // constraints and not whether the entity validates. if (($data instanceof ListInterface || $data instanceof ComplexDataInterface) && !$data->isEmpty() && !($data instanceof EntityAdapter && $constraints_given)) { foreach ($data as $property) { $this->validateNode($property); } }
- Status changed to RTBC
over 1 year ago 2:50pm 17 May 2023 - š§šŖBelgium borisson_ Mechelen, š§šŖ
Super interesting bug, good find. Are the other TypedData classes correct?
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
Are the other TypedData classes correct?
FieldConfigBase::getDataType()
is wrong too:public function getDataType() { return 'list'; }
ā¦ but I figured we'd keep this tightly scoped, because that is one of the most complex pieces of config š±
The last submitted patch, 3: 3361034-3-test-only-FAIL.patch, failed testing. View results ā
- Open on Drupal.org āEnvironment: PHP 8.2 & MySQL 8last update
over 1 year ago Waiting for branch to pass 41:16 37:22 Running41:16 38:43 Running- last update
over 1 year ago 29,375 pass, 2 fail The last submitted patch, 3: 3361034-3.patch, failed testing. View results ā
- š§šŖBelgium borisson_ Mechelen, š§šŖ
Looks like a random failure to me
- last update
over 1 year ago 29,401 pass - last update
over 1 year ago 29,401 pass - last update
over 1 year ago 29,402 pass - last update
over 1 year ago 29,411 pass - last update
over 1 year ago 29,416 pass - last update
over 1 year ago 29,434 pass - last update
over 1 year ago 29,437 pass - last update
over 1 year ago 29,437 pass - last update
over 1 year ago 29,445 pass - last update
over 1 year ago 29,450 pass - last update
over 1 year ago 29,499 pass - last update
over 1 year ago 29,499 pass - last update
over 1 year ago 29,508 pass - š³šæNew Zealand quietone
Triaging the RTBC queue.
What a easy issue to triage! The IS is clear and enjoyable to read. The situation is further explained in comment #5. I also agree with the scoping. All questions have been answered.
The only thin I see that it does appear this a followup is needed for #7.
I have updated the title to explain what is being changed.
26:16 22:30 Running- last update
over 1 year ago 29,553 pass - š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
#11 That's LOVELY to hear! šš Glad to read it helps and is appreciated!
New issue created, with a lot more detail than was present in #7: š Clarify why FieldConfigBase::getDataType() is 'list' and not 'field_config_base' Fixed .
- last update
over 1 year ago 29,559 pass - last update
over 1 year ago 29,567 pass - last update
over 1 year ago 29,571 pass - last update
over 1 year ago 29,801 pass - last update
over 1 year ago 29,801 pass - last update
over 1 year ago 29,802 pass - last update
over 1 year ago 29,804 pass - last update
over 1 year ago 29,811 pass - last update
over 1 year ago 29,814 pass - last update
over 1 year ago 29,815 pass - last update
over 1 year ago 29,815 pass - last update
over 1 year ago 29,826 pass - š¦š¹Austria fago Vienna
Good find! Yes, the typed-data implementation of config wasn't focused enough on implementing its contract cleanly.
The fix is straight forward, the right thing todo and comes with test! I second the RTBC!
- š«š®Finland lauriii Finland
Discussed with @longwave and @fago and agreed that we should write a short change record for the behavior change here.
25:26 21:41 Running-
lauriii ā
committed 89ac074f on 11.x
Issue #3361034 by Wim Leers, fago, borisson_, longwave: Make 'sequence...
-
lauriii ā
committed 89ac074f on 11.x
- Status changed to Fixed
over 1 year ago 5:33pm 23 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.