- π¨π¦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_hostvariable is, at some point, assigned aNULLvalue.The current patch silently accepts a (presumably, invalid?)
NULLvalue for$top_host. That may disguise a problem. It would be preferable to track down and address the source of thatNULLvalue.There are two points where
$top_hostis 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 aNULLvalue. 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_hostonly 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
over 1 year ago 8:08pm 11 March 2024