It seems that the multifield.module file is not load in some scenarios.

Error stack:

Fatal error: Call to undefined function multifield_extract_multifield_machine_name() in /var/www/docroot/sites/all/modules/contrib/multifield/multifield.install on line 66

Call Stack:
    0.0007     116756   1. {main}() /opt/drush/drush.php:0
    0.0323     144204   2. drush_main() /opt/drush/drush.php:16
    0.3739    1550768   3. _drush_bootstrap_and_dispatch() /opt/drush/drush.php:61
    0.6468    1553436   4. drush_bootstrap_to_phase() /opt/drush/drush.php:81
    0.6468    1553472   5. drush_bootstrap_max() /opt/drush/includes/bootstrap.inc:291
    0.7287    1746912   6. drush_bootstrap() /opt/drush/includes/bootstrap.inc:345
    0.7303    1747624   7. _drush_bootstrap_drupal_full() /opt/drush/includes/bootstrap.inc:185
    0.7303    1764416   8. drupal_bootstrap() /opt/drush/includes/bootstrap.inc:937
    0.8309    3301212   9. _drupal_bootstrap_full() /var/www/docroot/includes/bootstrap.inc:2311
    1.3772    6100356  10. module_invoke_all() /var/www/docroot/includes/common.inc:5318
    1.3839    6140196  11. call_user_func_array() /var/www/docroot/includes/module.inc:895
    1.3839    6140364  12. context_init() /var/www/docroot/includes/module.inc:895
    1.3912    6263648  13. context_condition_sitewide->execute() /var/www/docroot/sites/all/modules/modules/contrib/context/context.module:169
    1.3912    6263712  14. context_condition->get_contexts() /var/www/docroot/sites/all/modules/modules/contrib/context/plugins/context_condition_sitewide.inc:19
    1.3912    6263760  15. context_condition_map() /var/www/docroot/sites/all/modules/modules/contrib/context/plugins/context_condition.inc:160
    1.3921    6275008  16. context_enabled_contexts() /var/www/docroot/sites/all/modules/modules/contrib/context/context.module:421
    1.3921    6275172  17. context_load() /var/www/docroot/sites/all/modules/modules/contrib/context/context.module:358
    1.3947    6276084  18. ctools_export_load_object() /var/www/docroot/sites/all/modules/modules/contrib/context/context.module:232
    1.3980    6310848  19. ctools_export_get_schema() /var/www/docroot/sites/all/modules/modules/contrib/ctools/includes/export.inc:396
    1.3980    6311140  20. drupal_get_schema() /var/www/docroot/sites/all/modules/modules/contrib/ctools/includes/export.inc:983
    1.4004    6311552  21. DrupalCacheArray->offsetExists() /var/www/docroot/sites/all/modules/modules/contrib/ctools/includes/export.inc:3024
    1.4004    6311596  22. DrupalCacheArray->offsetGet() /var/www/docroot/includes/bootstrap.inc:358
    1.4004    6311624  23. SchemaCache->resolveCacheMiss() /var/www/docroot/includes/bootstrap.inc:369
    1.4004    6311696  24. drupal_get_complete_schema() /var/www/docroot/includes/bootstrap.inc:3049
    1.5803    6833472  25. module_invoke() /var/www/docroot/includes/bootstrap.inc:3095
    1.5803    6833680  26. call_user_func_array() /var/www/docroot/includes/module.inc:866
    1.5803    6833796  27. field_sql_storage_schema() /var/www/docroot/includes/module.inc:866
    1.5808    6834300  28. field_read_fields() /var/www/docroot/modules/field/modules/field_sql_storage/field_sql_storage.install:16
    1.6428    8659252  29. module_invoke() /var/www/docroot/modules/field/field.crud.inc:392
    1.6429    8660344  30. call_user_func_array() /var/www/docroot/includes/module.inc:866
    1.6429    8660552  31. multifield_field_schema() /var/www/docroot/includes/module.inc:866

Comments

e0ipso created an issue. See original summary.

e0ipso’s picture

The following patch solved the problem for me.

dmarkovic’s picture

+1
Thanks e0ipso.

This patch is needed either when you're using drush, or backup&migrate module to restore database.

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

I'm very confused by this. If we've reached calling hook_init(), it would be correct to assume that all the modules have already been included/loaded by the bootstrap process. Why wouldn't multifield.module be loaded in that case?

e0ipso’s picture

I'm copy pasting the same as before because it also applies here.

I have not been using multifield for a while now, and details are pretty fuzzy but I was getting this pretty consistently. I'm sorry I cannot provide more context.

Thanks for looping back Dave I know it takes a lot of effort!

berliner’s picture

@Dave Reid I'm confused as well by this, but I can confirm that this problem exists. It appeared in 2 out of 3 cases in our dev environments, but I couldn't figure out why it happened in general nor why it happened only in some of the environments but not in the others.

The patch in #2 is solving this problem for me too.

tatarbj’s picture

Status: Postponed (maintainer needs more info) » Needs review

Hi all,
I've found out the real issue that throws this issue, let me explain it:
The real issue comes by the fact when the install file gets triggered the other files of the module is still not loaded (so issue can come when uninstallation happens incorrectly) and this implementation tries to use a function that is written in the .module.
Also there is the way how hook_field_schema() implementations are called, there are basically three cases:
- field_create_field -> It dedicatedly includes the install file of the module that defines the field_schema. In the scope of this call there is no other files included, so if the e.g. .module file is not included by something else, than you can meet similar issues. https://api.drupal.org/api/drupal/modules%21field%21field.crud.inc/funct...
- field_update_field -> The same case just like before, includes directly the install file. It's just fine as all the things that are usually implemented in the hook_field_schema() implementations are in the install files. Again: if there are things that are defined out of the install files, something else has to include the other files, otherwise we end up meeting the same issues. https://api.drupal.org/api/drupal/modules%21field%21field.crud.inc/funct...
- field_read_fields -> that's the one that you also can see in the stack above. This case does identically the same, including the install files. https://api.drupal.org/api/drupal/modules%21field%21field.crud.inc/funct...
Overall we can call this practice as a design, to call only the install files where the hook_field_schema() implementations are. But as nowhere else we get the installed full module with all its defined things in the memory, than if there is a thing that is defined outside of the module install file when it gets installed, then you have to include it manually as the patch does.

I hope I've been enough clear to describe the case why the install file defined more complex field_schema throws issues - we also experienced it when all files were on the right place, module was previously disabled but not properly unsintalled, so we had reference in the system table, but module didn't allow to go forward with simple cc all commands even, breaking the processes. So this extra line is very needed there in order to make it work in every cases.

Bests,
Balazs.