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.

CommentFileSizeAuthor
#2 system.module.patch1.03 KBteezee
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Interesting.

I verified that it does not affect D6.x nor D7.x.

teezee’s picture

Version: 5.x-dev » 5.10
Status: Active » Needs review
FileSize
1.03 KB

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...

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;
}
tomsolo’s picture

i'm tested patch ok.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Based on #3.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 5.x. I wasn't able to reproduce the original issue, but more isset() and other checking is always good.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

dharmanerd’s picture

FYI. Same problem here. D-5.3. Patch works.