Closed (fixed)
Project:
Entity Reference Revisions
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Apr 2016 at 07:06 UTC
Updated:
13 Jun 2026 at 09:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
johnchqueThis should fix it the ERR part.
Comment #3
berdirTest coverage for this should be pretty easy.
In an existing test with an entity that references another, delete the referenced entity and then resave the parent, that should be enough to trigger this.
Comment #4
johnchqueYes, the problem is triggered with steps on comment #3. Added tests.
Comment #6
berdirComment in the test is no very clear, but Miro can improve that on commit I think if he has an idea for improving it?
Comment #7
chr.fritschUsing devel_generate for creating nodes with paragraphs is still borken.
Got this message:
Comment #8
berdirThat's not the fault of this issue, if anything, we just change the error because it fails differently. ERR needs specific integration for devel_generate.
Comment #9
killua99 commentedCould we add test coverage for PostgreSQL?
I open the bug about update paragraphs 8003 and we use PostgreSQL
Comment #10
berdirI added a test with PostgreSQL for the patch. This has nothing to do with the database. If it fails then HEAD very likely already fails too.
@Miro: Can you enable on commit testing for PHP7 + mysql/postgresql/sqlite on https://www.drupal.org/node/2411903/qa? just php7 for those should be enough and it's faster.
Comment #12
miro_dietikerThx, fixed.
Comment #13
miro_dietikerAdd missing reference.
Comment #15
alex ua commentedStill reproduces on 1.14, and there's a clear asymmetry that makes the fix a one-liner:
EntityReferenceRevisionsItem::onChange()guards thetarget_idwrite for a new/unsaved target viaisTargetNew(), but the siblingtarget_revision_idwrite calls$property->getValue()->getRevisionId()with no null-guard — so when the computedentityproperty is NULL, it fatals withCall to a member function getRevisionId() on null.Real-world trigger seen in the wild: Drupal core's
DefaultContentimporter passes a failed dependency lookup (NULL) into an ERR field when recipe default content contains a_meta.dependscycle (filed against core as #3595546 — core shouldn't pass NULL, but ERR fataling here makes the authoring mistake much harder to diagnose). Any$item->set('entity', NULL)reproduces it.Fix: mirror the
target_idbranch — guard thegetRevisionId()call and write NULL totarget_revision_idwhen there is no referenced entity. Also related: #2675076 (the adjacentonChange('entity')revision-id concern). Happy to roll a patch + test.Comment #16
it-cru@alex ua: On such an old issue it maybe make sense to create a new one for providing MR / tests with your findings on 8.x-1.14 and relates this one to it.