Originally reported by: @mhavelant
Gitlab PR: https://github.com/brainsum/gdpr/pull/8
modules/gdp_fields/src/Plugin/Deriver/TypedDataEntityRelationshipReverseDeriver.php
<?php
// Provide the entity type.
$derivative_id = $data_type_id . ':' . $property_name;
if (isset($this->derivatives[$derivative_id])) {
?>
This throws notices and results in a "function call on null" error down the line, as 'target_entity_type' doesn't exist in some cases.
TypedDataEntityRelationshipReverseDeriver::generateDerivativeDefinition() calls the parent generateDerivativeDefinition, which doesn't seem to properly populate the derivatives array. Also, generateDerivativeDefinition() runs twice, and the second time the target_entity_type is there as one would expect.
Paths where I'm getting the exception:
- /admin/reports/fields/gdpr-fields
- /admin/gdpr/tasks/1
- /user/1/gdpr-request/gdpr_sar
Comments
Comment #2
yanniboi commentedI discovered another patch that I had been using on my environment (provided by another module) that fixes an issue in ctools which is described here: #2866323: Fatal error on empty entity reference relationship.
Comment #3
yanniboi commentedComment #4
yanniboi commentedOK, no, turns out my hunch is wrong. That patch was already incorporated in the other patch that composer.json requires.
So I am stuggling to recreate this error. My environment is as follows:
Drupal core: 8.5.3
GDPR: 8.x-1.x branch
Ctools: 3.0.0 with 2951267-2.patch
Some user fields configured as below
Field config page:
SARS Task View:
Comment #5
baluertlComment #6
mhavelant commentedI still get this error.
Setup: Minimal profile install of 8.5.3 running in the lates wodby/docker4drupal environment (5.0.6)
This setup gives no errors when the only additionally enabled modules are gdpr, gdpr_dump and gdpr_fields.
However, enabling either of the remaining sub-modules gdpr_tasks or gdpr_consent, the exception occurs.
Every backtrace shows that the $data_type_id is an entity_revision (e.g "entity_revision:message:consent_agreement_accepted").
If I add this inside the
if (isset($this->derivatives[$derivative_id])) {conditionthen the exception goes away and dpm shows only entity_revision items.
The full list of these after reinstalling my local site with the standard profile and enabling all of our gdpr modules (+ these: automated_cron config update adminimal_admin_toolbar devel kint field_ui):
Comment #8
yanniboi commentedWow, great job! I can't believe it took us this long to be able to recreate this :P
I have updated the test to show the error and fixed it by excluding entity_revision relationships. We can choose to support this in the future, but only if we find scenarios that justify it.
Comment #9
yanniboi commentedPushed commit https://www.drupal.org/commitlog/commit/91358/bc64a056c0db7cdc283764d231... to 8.x-1.x.
Comment #10
baluertlMoving issue state manually from Fixed 🠂 to Closed (fixed) in the hope that issue queue gets cleaner a bit.