hook_hook_info() is invoked via module_enable()
before the drupal kernel was able to reboot, so the autoloader isn't setup properly.

The fix just moves the invoking of hooks below updating the list of module.

That's not a problem unless you use static methods in hook_hook_info.

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new368 bytes

Let's see whether this breaks something.

Status: Needs review » Needs work

The last submitted patch, drupal-1975354-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.1 KB
new1.46 KB

This patch seems to fix the problem.

ParisLiakos’s picture

ParisLiakos’s picture

Issue tags: +Needs tests

this is because _system_update_bootstrap_status triggers module handler's hook info rebuild first, and, well this happens before kernel being rebuilt, which means that new namespaces/classes provided by enabled module is not available in the hook_info invocation

while update bootstraps are gonna be removed, this could still happen sometime, so i think that we should have a test for this

dawehner’s picture

StatusFileSize
new1.55 KB

I tried to write a test for that (see patch), though I realized that simpletest loads all classes into an autoloader somehow, see simpletest_classloader_register().

dawehner’s picture

Another issue I have seen with this can be seen on http://qa.drupal.org/pifr/test/510073

There is an exception thrown which is caused by the following backtrace.
module_enable(array('rdf'))
Drupal::service('theme.registry')->reset();
...
views_theme()
...
field_views_data()
...
entity_get_bundles()
...
rdf_mapping_load_multiple()

The problem now is that module_enable() first resets the theme and then installs the schema.

ParisLiakos’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

no tests then:(
simpletest just loads everything:/
well lets get #3 in for now

ParisLiakos’s picture

StatusFileSize
new1.1 KB

reuploading the correct patch to avoid confusion

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 7a53837 and pushed to 8.x. Thanks!

olli’s picture

Closed duplicate #1968090: During installation the moduleHandler calls hook_hook_info without having the classloader setup properly.

While trying to write a test (for a same fix as here) I noticed that after moving the function below updateModules(), hook_info is not invoked during module_enable anymore.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

blub