- Issue created by @rbosscher
- Status changed to Needs review
12 months ago 1:03pm 12 January 2024 - last update
12 months ago 1 pass - 🇳🇱Netherlands rbosscher
Hi thanks for the patch, it seems to fix it at line 281, but now raises a new error:
TypeError: Drupal\gdpr_fields\Entity\GdprField::propertyCanBeRemoved(): Argument #1 ($field_definition) must be of type Drupal\Core\Field\FieldDefinitionInterface, null given, called in /var/www/public_html/modules/contrib/gdpr/modules/gdpr_fields/src/Form/GdprFieldSettingsForm.php on line 378 in Drupal\gdpr_fields\Entity\GdprField->propertyCanBeRemoved() (line 369 of modules/contrib/gdpr/modules/gdpr_fields/src/Entity/GdprField.php).
- 🇳🇱Netherlands rbosscher
It appears that:
`$fieldDefinition = $fieldManager->getFieldDefinitions($entity_type, $bundle_name)[$field_name]` returns `null`.
On the other hand, `$fieldDefinition = $fieldManager->getFieldDefinitions($entity_type, $bundle_name)` returns the current entity without the field that is yet to be created. So it returns null because the new field is not in the fieldDefinition.
Not sure this is a breaking change in core as the fieldmanger is identical to 10.1
- last update
12 months ago 1 pass - last update
11 months ago Composer require failure - last update
11 months ago 1 pass - last update
11 months ago 1 pass Any update on this issue ?
In my D10.2 application , For the patch #2 it is still raising this error
TypeError: Drupal\gdpr_fields\Entity\GdprField::propertyCanBeRemoved(): Argument #1 ($field_definition) must be of type Drupal\Core\Field\FieldDefinitionInterface, null
Using the #5 seems to bypass the error and let user create fields but it still throws this warning when I am trying.
Warning: Undefined array key "field_x" in Drupal\gdpr_fields\Form\GdprFieldSettingsForm::buildFormFields()
This is quite a major issue hope it can be resolved quickly.
- 🇧🇪Belgium bart lambert
I'm having the same issue.
Applied patch issue_3414301.patch but i'm now getting following error:Warning: Undefined array key "field_url_van_de_video" in Drupal\gdpr_fields\Form\GdprFieldSettingsForm::buildFormFields() (line 263 of modules/contrib/gdpr/modules/gdpr_fields/src/Form/GdprFieldSettingsForm.php).
So I think somewhere there is still something missing....
Any Idea's how To fix this?
- First commit to issue fork.
- 🇭🇺Hungary eFeS
I've the same situation as EZKG. Neither patch #2, nor #5 solved the initial problem under Drupal 10.2.5, PHP8.1.27
- 🇳🇱Netherlands ahmetburkan Utrecht
After some detective work and debugging i think that we need to think about how we approach this issue. See 3383986 →
Current situation:
There is a workaround patch at comment #5 🐛 Fatal error when adding a field to any entity type (e.g., basic page node) with GDPR module enabled on Drupal 10.2.1 Needs review . This will disable the functionality to be able to configure GDPR fields while creating the new field. After saving the field editing the GDPR settings is possible. This requires an extra step for now.Future:
We need to make a discission how we continue because it is not possible anymore to load the newly created field because it hasn't been saved until the last step in the field creation flow. That makes the function getFieldDefinitions() obsolete when calling it from the 'gdpr_fields.module' but not when you go directly to the route after saving the new field. - Status changed to Needs work
8 months ago 10:22am 26 April 2024 - 🇳🇱Netherlands eelkeblok Netherlands 🇳🇱
I think the information that is being pulled from the field config should also be available in the form state for the form when first creating the field. We should probably make a change such that the code can get the required information from there too, if it needs to. Both for the standalone GDPR config form as well as the previous core version.
- 🇳🇱Netherlands ahmetburkan Utrecht
ahmetburkan → changed the visibility of the branch 3414301-fatal-error-when to hidden.
- 🇳🇱Netherlands ahmetburkan Utrecht
ahmetburkan → changed the visibility of the branch 3414301-fatal-error-when to hidden.
- last update
8 months ago 1 pass - Status changed to Needs review
8 months ago 8:28pm 30 April 2024 - last update
8 months ago 1 pass - Status changed to Needs work
8 months ago 9:34am 2 May 2024 - 🇳🇱Netherlands eelkeblok Netherlands 🇳🇱
As a generic comment, in addition to the detailed comments in the MR, I wonder whether the buildFormFields() method could be simplified; the buildForm, which is the other place that calls this, I already checking if the field config exists, so it would be a small change to have it pass that into the buildFormFields(). If we can move the burden of getting the proper field config to the calling code (either pulling it from field storage, or from the form state when in the field creation flow), that could simplify the buildFormFields method a great deal.
Maybe this should become a follow-up, since the module is actually actively braking Drupal 10.2 sites.
Must-fix changes:
- The translated message
- Documentation for the new parameter
- Not allowing notices/warnings to bubble from the code (mostly on unset array keys; for Drupal 10.2, this happens here: https://git.drupalcode.org/project/gdpr/-/merge_requests/32#note_306162. I suspect it will happen in other places for Drupal 10.1 and below.
- 🇮🇳India rajeshreeputra Pune
changes seems working, agree with @eelkeblok that this change might break with lower drupal version. To avoid this we should add test to create content type and add field to it.
- First commit to issue fork.
- Status changed to Needs review
5 months ago 2:21pm 15 July 2024 - Status changed to RTBC
5 months ago 8:50am 16 July 2024 -
Rajeshreeputra →
committed 156aea95 on 3.0.x authored by
ahmetburkan →
Issue #3414301 by Rajeshreeputra, ankitv18, deepakkm: Fatal error when...
-
Rajeshreeputra →
committed 156aea95 on 3.0.x authored by
ahmetburkan →
- Status changed to Fixed
5 months ago 8:05am 17 July 2024 Automatically closed - issue fixed for 2 weeks with no activity.