- π¨π¦Canada nedjo
Thanks for noting the error and for contributing the proposed fix.
The error in
field_collection_field_update()
(an implementation of hook_field_update()) indicates the$top_host
variable is, at some point, assigned aNULL
value.The current patch silently accepts a (presumably, invalid?)
NULL
value for$top_host
. That may disguise a problem. It would be preferable to track down and address the source of thatNULL
value.There are two points where
$top_host
is assigned a value. First, it's seeded with the value passed in by the code invoking the hook:$top_host = $host_entity;
. Second, it's conditionally reset to the return value of a::hostEntity()
method call:while (method_exists($top_host, 'hostEntity')) { $top_host = $top_host->hostEntity(); }
While it's possible the first assignment is the source of this bug - that is, the hook is being invoked with broken data- that seems less likely on the face of it. That leaves the possibility that the
::hostEntity()
method method is returning aNULL
value. And, indeed, the return value ofFieldCollectionItemEntity::hostEntity()
is only conditionally an entity, and otherwiseNULL
.On that basis, the correct fix here would seem to be to reassign the value of
$top_host
only if the::hostEntity()
call has returned a non-NULL value.Patch attached. No interdiff as this does not continue from the prior patch.
- πΊπΈUnited States emerham
Ran into this problem when updating a single node that used paragraphs with field collections. Was unable to find the issue but this patch solved the problem.
- Status changed to RTBC
9 months ago 8:08pm 11 March 2024