Autoload has a known issue where classes are not found when a module is first enabled. A work around is to clear the cache to rebuild the cache.

I have marked the issue as major as it:

  • Breaks simple tests.
  • Causes errors like Fatal error: Class 'Messaging_Method_Mail' not found to appear when a module is first enabled.

The issue is known in the autoload issue queue #826050: Reload cache on missing class.

The issue above recommends project implement their own fix in the form of autoload_flush_caches() from their hook_enable()

This fix may help the following threads:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JoeMcGuire’s picture

Status: Active » Needs review
FileSize
1.71 KB

Attached patch adds hook_enable() with autoload_flush_caches() too messaging and messaging_mail which are the two affected modules which include hook_autoload_info

This allows you to run the test Messaging_Methods_Tests and stops sites generating class not found when the module is first enabled.

JoeMcGuire’s picture

If you are using messaging in combination with notifications it is also suffering from the same issue and has a related issue/patch: #1351782: Autoload classes not found on enable.

JoeMcGuire’s picture

If you are enabling the modules via hook_update_N and drush you might still see class not found errors - this is a related issue and requires a fix in addition to this patch see #1354616: Class not found when enabling modules with hook_update and Drush.