backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

Docs for EntityInterface::uri() incorrectly state that NULL should be returned if entity has no uri. #6749

Closed argiepiano closed 1 week ago

argiepiano commented 1 week ago

Description of the bug

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.

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

argiepiano commented 1 week ago

PR https://github.com/backdrop/backdrop/pull/4899 submitted and ready for review.

quicksketch commented 1 week ago

Thank you @argiepiano and @elisseck! Merged https://github.com/backdrop/backdrop/pull/4899 into 1.x and 1.29.x.