- Status changed to Needs work
almost 2 years ago 11:17pm 30 March 2023 - π¨π¦Canada nedjo
Thanks for reporting the issue and contributing a proposed fix.
I haven't seen this issue occur, just commenting as part of going through reported PHP 8.1 compatibility issues. I've only taken a brief glance so my comment should be taken as tentative notes made while passing through.
That said...
The issue appears to be in the data returned by
entity_get_all_property_info()
. The relevant code inentity_views_field_definition()
looks to expect a keyed array for thearray $property_info
argument. So casting as an array whatever data is returned byentity_get_all_property_info()
may mask the error without addressing the root cause.Suggested next step in debugging: determine what non-array values are being returned as part of the
entity_get_all_property_info()
return value and debug from there, considering the possibilities that the issue may or may not be in this module.Hope that's helpful!
- π¨π¦Canada nedjo
- $title = $title_prefix . $property_info['label']; + $title = $title_prefix . (isset($property_info['label']) ? $property_info['label'] : '');
Re this bit, hmm. It looks like it's possible to get back a
$property_info
array that doesn't have a 'label' key. Is that a valid result? If so, then, yes, this appears to be an appropriate use for the ternary operator.Since this snippet appears to be constructing a user-facing string, it's not totally clear that the
$title_prefix
is expected to be valid on its own. This call inentity_views_field_definition()
feeds a string that would look odd on its own:entity_views_field_definition($field . ':' . $nested_key, $nested_property, $table, $title . ' Β» ');
In that usage, in the case of a missing 'label' key, we might want just the
$title
without the ' Β» '. Though whether that's an edge case that's worth addressing at this point....