When drupal_check_profile()
checks installation requirements, it doesn't check the type of the values returned from hook_requirements
implementations before sending them to array_merge()
. This results in an error if an implementation doesn't return a value for the 'install' phase.
e.g.
function mymodule_requirements($phase) {
if ($phase !== 'runtime') {
return;
}
return [
// ...runtime requirements...
];
}
The current check:
if (function_exists($function)) {
$requirements = array_merge($requirements, $function('install'));
}
For comparison, ModuleHandler::invokeAll()
only merges if isset()
passes:
if (isset($result) && is_array($result)) {
$return = NestedArray::mergeDeep($return, $result);
}
elseif (isset($result)) {
$return[] = $result;
}