The documentation for EntityInterface::uri() incorrectly state that NULL should be returned if the entity has no uri of its own.
Returning NULL creates a fatal error when template_preprocess_entity() is invoked: TypeError: Unsupported operand types: null + array, since that preprocess function uses the + array operator with the returned value (NULL).
Instead, the docs should say that an empty array should be returned.
Description of the bug
The documentation for
EntityInterface::uri()
incorrectly state thatNULL
should be returned if the entity has no uri of its own.Returning NULL creates a fatal error when
template_preprocess_entity()
is invoked:TypeError: Unsupported operand types: null + array
, since that preprocess function uses the+
array operator with the returned value (NULL).Instead, the docs should say that an empty array should be returned.
Steps To Reproduce
This was originally reported in the
commerce
issue queue: https://github.com/backdrop-contrib/commerce/issues/25 See steps there. A custom, uri-less entity class is needed.Actual behavior
Fatal error when uri returns NULL
Expected behavior
Not a fatal error.
Additional information
Backdrop 1.29.1