Fatal error: on /admin/build/modules/list/ page
kenorb - July 5, 2008 - 14:17
| Project: | Drupal |
| Version: | 5.10 |
| Component: | system.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
When going to /admin/build/modules/list/ you receiving following fatal error:
Fatal error: Cannot use string offset as an array in /modules/system/system.module on line 1439
I know that isn't correct url, but there shouldn't be any fatal error, you can't handle it with default error page.
$form_values = string 'list' (length=4)
--
if (!$module->status && $form_values['status'][$name] && isset($module->info['dependencies'])) {So it mean that you can't use $form_values['status'][$name] when $form_values is a string.

#1
Interesting.
I verified that it does not affect D6.x nor D7.x.
#2
This problem occurs when you visit the admin/build/modules/uninstall page before returning to the overview of installed modules in admin/build/modules/list. The *list* part is the problem here because it is passed as extra argument to the calling function (system_modules).
The system_modules function calls the confirmation form, which then calls the system_module_build_dependencies() where it all goes wrong.
Attached patch adds an extra check to the if statement, in the original situation only isset($form_values) is called, I've added an is_array($form_values) and another check inside the loop.
Please check the attached patch...
<?php
function system_module_build_dependencies($modules, $form_values) {
static $dependencies;
if (!isset($dependencies) && isset($form_values) && is_array($form_values)) {
$dependencies = array();
foreach ($modules as $name => $module) {
// If the module is disabled, will be switched on and it has dependencies.
if (!$module->status && isset($form_values['status'][$name]) && $form_values['status'][$name] && isset($module->info['dependencies'])) {
foreach ($module->info['dependencies'] as $dependency) {
if (!$form_values['status'][$dependency] && isset($modules[$dependency])) {
if (!isset($dependencies[$name])) {
$dependencies[$name] = array();
}
$dependencies[$name][] = $dependency;
}
}
}
}
}
return $dependencies;
}
?>
#3
i'm tested patch ok.
#4
Based on #3.
#5
Committed to 5.x. I wasn't able to reproduce the original issue, but more isset() and other checking is always good.
#6
Automatically closed -- issue fixed for two weeks with no activity.
#7
FYI. Same problem here. D-5.3. Patch works.