Problem/Motivation

Early on, ModuleInstaller::install() has a check for sanity in the requested module list:

    $module_data = \Drupal::service('extension.list.module')->reset()->getList();
    foreach ($module_list as $module) {
      if (!empty($module_data[$module]->info['core_incompatible'])) {
        throw new MissingDependencyException("Unable to install modules: module '$module' is incompatible with this version of Drupal core.");
      }
  ETC

However, the check for a module that doesn't exist only happens if $enable_dependencies is TRUE:

    if ($enable_dependencies) {
      $module_list = $module_list ? array_combine($module_list, $module_list) : [];
      if ($missing_modules = array_diff_key($module_list, $module_data)) {
        // One or more of the given modules doesn't exist.
        throw new MissingDependencyException(sprintf('Unable to install modules %s due to missing modules %s.', implode(', ', $module_list), implode(', ', $missing_modules)));
      }

Steps to reproduce

Proposed resolution

Move the check to the earlier loop and convert it to an `isset($module_data[$module])

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3583648

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joachim created an issue. See original summary.

ishani patel’s picture

Assigned: Unassigned » ishani patel

ishani patel’s picture

Assigned: ishani patel » Unassigned

Hello
I've updated the changes for the non-existent module.
Raised MR for that. Kindly review it.

Thanks!

joachim’s picture

Status: Active » Reviewed & tested by the community

Looks good. Thanks!