field_read_fields() is called from field_sql_storage_schema() for schema building.
It iterates over all fields, including those that are marked as deleted.

For every field, it calls

module_load_install($field['module']);

It does not care whether the module is disabled, uninstalled, or missing in the filesystem.

If the module code is missing, the result can be the warning below, even though the module is nowhere in the system table:

User warning: The following module is missing from the file system: MODULE_NAME. In order to fix this, put the module back in its original location. For more information, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1129 of /[..]/includes/bootstrap.inc).

I suppose this only happens if something went wrong at some point. Ideally the fields should have been cleaned up before removing the module code.

But nevertheless, we should have a more relevant error message, e.g. "The field FIELD_NAME uses a field type TYPE from module MODULE, which no longer exists in the filesystem. Something must have gone wrong that led to this situation. To clean this up, do XYZ."

(maybe it is good enough to run cron)

Solution / To do

Decide which cases need special treatment:
- Module code still exists, but module is disabled.
- Module code still exists, but module is uninstalled.
- Module code is missing.
- All of this, one time for a "deleted" field and another time for an active field.

Implement a suitable error behavior and message.

Comments

donquixote created an issue.