- 🇫🇮Finland heikkiy OuluWe also encountered this error after updating core to 9.5.10 and PHP 8.1. I don't remember seeing the error with PHP 8.0. In our case we seem to get two different warnings: Warning: Undefined array key "#parents" in Drupal\Core\Form\FormState->getError() (line 1137 of /var/www/html/builds/2023-09-19.10-55-49.tag--0.0.47__db59b9ce6/web/core/lib/Drupal/Core/Form/FormState.php) Warning: foreach() argument must be of type array|object, null given in Drupal\Core\Form\FormState->getError() (line 1137 of /var/www/html/builds/2023-09-19.10-55-49.tag--0.0.47__db59b9ce6/web/core/lib/Drupal/Core/Form/FormState.php)
- First commit to issue fork.
- Merge request !5230Issue #3027240: Undefined index: #parents FormState.php (11.x) → (Open) created by recrit
- Status changed to Needs reviewalmost 2 years ago 7:46pm 2 November 2023
- 🇺🇸United States recritI created a new branch and MR 5230 for 11.x. This branch also address the 2 threads on the original MR 1300: - "The point of the test is to prove there is no notice - so this name is a bit odd." by @alexpott
- The class was renamed to "FormAfterBuildTest".
 
- "It doesn't trigger a notice any more - right? Is the error handler approach necessary here? I think it's not - we'd error if there was a notice as far as I know." by @alexpott
- The test was updated to catch any errors when the form is submitted instead of using an error handler.
 
 
- "The point of the test is to prove there is no notice - so this name is a bit odd." by @alexpott
- 🇺🇸United States recritAttached is a static patch of the MR 5230 at commit 2c405b97. This can be used for consistent composer builds. 
- First commit to issue fork.
- Status changed to Needs workalmost 2 years ago 5:26pm 3 November 2023
- 🇺🇸United States smustgraveRebased and ran test-only feature for MR 5230. https://git.drupalcode.org/issue/drupal-3027240/-/jobs/272556 They passed when they should have failed. 
- Status changed to Needs reviewalmost 2 years ago 6:34pm 3 November 2023
- 🇺🇸United States recrit@smutsgrave I suspect it is how you are testing the "test only". The changes in core/modules/system/tests/modules/form_test/form_test.moduleare needed for the test but the job https://git.drupalcode.org/issue/drupal-3027240/-/jobs/272556 is reverting that change (see screenshot attached).
- 🇺🇸United States recritattached is a tests only patch of MR5230 at commit 2c405b97. This should fail. 
- last updatealmost 2 years ago 30,486 pass, 1 fail
- Status changed to Needs workalmost 2 years ago 4:12pm 4 November 2023
- 🇺🇸United States smustgraveThanks for the test-only patch. It indeed does show the failure so removing the tests tag. Change seems fine and hate to do it but could the issue summary be updated also. Solution "Apply patch" isn't a real solution description and could be kicked back just for that. Issue summary is to help the committer understand the issue and what the fix is. Thanks! 
- Status changed to Needs reviewalmost 2 years ago 2:08pm 5 November 2023
- Status changed to RTBCalmost 2 years ago 2:23pm 5 November 2023
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago CI error
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,249 pass, 22 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- last updatealmost 2 years ago 29,261 pass, 20 fail
- 35:20 - 33:57 Running
- Status changed to Needs workalmost 2 years ago 4:28am 4 December 2023
- 🇳🇿New Zealand quietoneI'm triaging RTBC issues → . I read the IS and the comments. I think the following still need to be answered 
 #50 🐛 Undefined index: #parents FormState.php RTBC
 #37 🐛 Undefined index: #parents FormState.php RTBC
 and are mentioned in #55 as a point of concern.I am setting to needs work for those items. 
- 🇺🇸United States luke.leber PennsylvaniaFWIW - I managed to stumble in here while trying to add an error to an #itemFAPI element. My particular case (heavy in custom code territory) is that I have a third party javascripty thing (reCAPTCHA) that needs to block form submit in certain cases.$element['error'] = [ '#type' => 'container', 'recaptcha_error_message' => [ '#type' => 'item', '#markup' => '' ] ]; // Sometime later... $form_state->setError($element['error']['recaptcha_error_message'], $error);I wonder -- are there certain FAPI element types that simply weren't intended to support error messages associated with them? 
- last updateover 1 year ago 29,722 pass
- 🇺🇸United States pbabinRan into an issue today that triggered this. The patch from MR! 1300 fixed our issue. 
- Status changed to RTBCover 1 year ago 9:45pm 6 May 2024
- 🇨🇦Canada joseph.olstadThe code that fixes this was vastly simplified since comments #57, #55 and #37 effectively deprecating those comments. This is a very simple change with an automated test that has a test only failure. It is needed. 
- 🇬🇧United Kingdom alexpott 🇪🇺🌍alexpott → changed the visibility of the branch 3027240-undefined_parents to hidden. 
- 🇬🇧United Kingdom alexpott 🇪🇺🌍alexpott → changed the visibility of the branch 11.x to hidden. 
- 🇬🇧United Kingdom alexpott 🇪🇺🌍alexpott → changed the visibility of the branch 10.1.x to hidden. 
- 🇬🇧United Kingdom alexpott 🇪🇺🌍alexpott → changed the visibility of the branch 9.3.x to hidden. 
- Status changed to Needs workover 1 year ago 11:15am 7 May 2024
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
- 🇧🇪Belgium kribooghAdded patch of MR5230 for use in composer. 
 Applies to 11.x and 10.3.x
- 🇦🇲Armenia murz Yerevan, ArmeniaGot the same issue in another place, in the function ConfigFormBase::checkConfigOverrides() when it creates a warning message that some values are overridden: 1) core/lib/Drupal/Core/Form/FormState.php:1174 Undefined array key "#parents"Just posting here to help search for the source of this warning.