#287647 by mikejoconnor, lilou, cafuego, bjaspan, and robertDouglass: Cast results of hook_schema() to an array to avoid schema corruption.

merge-requests/26/head
Angie Byron 2009-11-01 23:10:14 +00:00
parent 14c1c505e0
commit 267c290cf5
1 changed files with 4 additions and 1 deletions

View File

@ -1840,7 +1840,10 @@ function drupal_get_schema($table = NULL, $rebuild = FALSE) {
require_once DRUPAL_ROOT . '/includes/common.inc';
// Invoke hook_schema for all modules.
foreach (module_implements('schema') as $module) {
$current = module_invoke($module, 'schema');
// Cast the result of hook_schema() to an array, as a NULL return value
// would cause array_merge() to set the $schema variable to NULL as well.
// That would break modules which use $schema further down the line.
$current = (array) module_invoke($module, 'schema');
_drupal_schema_initialize($module, $current);
$schema = array_merge($schema, $current);
}