We just encountered quite a nasty "feature".
Currently working on a new site using the latest stable Drupal 6.x. We have installed lots of modules. Everything has been working out fine. Then suddenly nodes and users would stop loading and the watchog-table would start to fill up. What had happened was that one module we had previously enabled had with a later update gotten an empty hook_schema definition. While working on the site we deleted all entries in the cache-table and suddenly everything went black. Backtracking to a specific node was not easy, because several modules had been updated since the faulty module.
The reason for all the problems, are that this code in function drupal_get_schema, does no checking on the return value:
$current = module_invoke($module, 'schema');
_drupal_initialize_schema($module, $current);
$schema = array_merge($schema, $current);
So when we suddenly had an empty hook_schema, array_merge would fail miserably and destroy the whole schema-array. I really believe there should be some check done on the on this line:
$current = module_invoke($module, 'schema');
Could be as simple as this:
$current = (array) module_invoke($module, 'schema');
Or this:
$current = module_invoke($module, 'schema');
if(is_array($current)) {
_drupal_initialize_schema($module, $current);
$schema = array_merge($schema, $current);
}
Comments
Comment #1
damien tournoud commentedThanks for the report. This is already being dealt with on #287647: Invalid hook_schema() result can trash entire schema.