EDIT: August 6, 2015
It turns out that this was actually caused by incomplete data of module_implements cached in the database by Drupal which caused a hook_init to not be called. We changed the weight but also had cleared the cache and had incorrectly attributed the fix to correcting the weight.
We have a Drupal 7 site with mimemail and htmlmail modules installed. The htmlmail has a weight of 10 since it needs to be loaded after mimemail.
However, recently, the following PHP error started occur in the logs:
PHP Fatal error: Call to undefined function mailsystem_html_to_text() in /path/to/sitefolder/sites/all/modules/htmlmail/htmlmail.mail.inc on line 62".
We were able to track it down to the "weight" column in the registry table where the weight for class "HTMLMailSystem" has a weight of 0 when it should have been 10. Manually changing it to back to 10 fixed the issue.
We confirmed that there has been no active development or any core/module updates around the site this error started to occur.
Does anyone know what could have caused the weight to change?
Futher investigation by running the following query revealed no discrepancies in module weight between the registry and system tables on the development site
SELECT r.*,
s.name,
s.weight
FROM `registry` r
LEFT JOIN `system` s ON r.module = s.name
WHERE r.weight != s.weight
However, on the production site, the following entries module entries have a different weight between the two tables so it's possible other modules were affected too by whatever caused this - it just hasn't caused additional errors (such as due to the default load order perhaps being fine for those).
views_plugin_localization_core
views_plugin_localization_none
views_plugin_row_user_view
WebformComponentsTestCase
WebformGeneralTestCase
WebformPermissionsTestCase
WebformSubmissionTestCase
WebformTestCase
webform_exporter
webform_exporter_delimited
webform_exporter_excel
webform_handler_field_form_body
webform_handler_field_is_draft
webform_handler_field_node_link_edit
webform_handler_field_node_link_results
webform_handler_field_submission_link
webform_handler_field_webform_status
webform_handler_filter_is_draft
webform_handler_filter_webform_status