Problem/Motivation
In some cases, it seem to be possible that $this->shortcut_set->entity is NULL in the Shortcut class. In this case, calling getCacheTagsToInvalidate() will raise a fatal error, instead of returning a default safe value.
Proposed resolution
Check if the entity property of the shortcut set is not null before attempting to call getCacheTags(), and if null return an empty array.
Remaining tasks
Review patch
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 2612670-2.patch | 610 bytes | jcnventura |
Comments
Comment #2
jcnventuraComment #3
jibranThe fix seems fine but can you please add test to show the bug?
Comment #4
jcnventuraNot sure if it is possible to add anything other than a unit test. In #2612678: Incompatible with core language we need to figure out why the shortcut set is being created without an entity.
It currently depends on the standard profile, the (core) language module and the (contrib) config_installer. Possibly there's a bug in config_installer that triggers this bug.
Comment #5
wim leersThis is wrong.
It will cause missing cache tags. And will thus cause cache invalidation problems.
The real problem lies elsewhere. It should not be possible to have a shortcut content entity without a
shortcut_setconfig entity already existing.Comment #16
lendudeI agree with @Wim Leers that the suggested fix here is just hiding the real problem.
Since no feedback was given on the response in #5 I'm going to close this for now. If you feel this is something that still needs to be addressed feel free to reopen this.
Comment #17
lendude