Problem/Motivation
Reading a characteristics field asks the entity type manager for the mycharacteristic storage twice, and neither call checks that the entity type exists. It is provided by a module this one does not depend on, does not suggest and does not document, so on a site that has a field named field_characteristics and not that module, reading it throws PluginNotFoundException and the endpoint answers 500.
The same method already knows how to do it right: two lines below, the sibling entity type is asked for through hasDefinition() and skipped when it is absent. Only one of the two was guarded.
Proposed resolution
- Guard both calls the way the sibling one is guarded, and answer with an empty structure when the entity type is not installed — the same way a missing field reads as an empty value rather than as an error.
- Cover it with a kernel test: a site without that entity type reads the field and gets an empty list instead of an exception.
- Check the rest of the module for entity types asked for by name without a check; this one was found by grep, not by a failure.
Remaining tasks
Everything.
Issue fork myrest-3619421
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
sergeydruua commentedComment #6
sergeydruua commented