In the funciton entity_uri, there is the possibility to create an URI by a callback function.
But after calling that callback, there is no check if it actually returned something.

As an example: the entity module has a default entity uri callback to allow other modules to create a uri by a hook.
But when no hooks are present, the callback doesn't return a uri. In my opinion a legal result.

But the entity_uri function assumes the callback always returns a value, and appends some options.
Because of this, a invalid response is returned, because the 'path' property is missing.

I will attach a patch.

Comments

wjzijderveld’s picture

StatusFileSize
new658 bytes

I think this check is okay.
But maybe it is needed to check for the actual existence of the 'path' property?

longwave’s picture

I think this is a duplicate of #1275902: Allow entity URI callbacks to indicate that the entity has no URI, and make the User module use that for anonymous users, there is much more discussion of the issue over there.

wjzijderveld’s picture

Status: Active » Closed (duplicate)

I did found that issue, but had the feeling it tried to solve a different issue and it is set to 8.x
But now I see that the latest patch there also solves this issue. I just didn't read the thread far enough.

I'll close this as duplicate then.