Dependent modules are still installed when requested modules return errors in hook_requirements('install')

Created on 5 March 2013, over 12 years ago
Updated 9 June 2025, 15 days ago

This is related to #592800: Dependent modules are still installed when required modules return errors in hook_requirements('install') β†’ , which appears to have been fixed.

Here's what happens:

1. Enable module A in the module admin
2. Module A depends on module B: get taken to the 'do you want to enable module B?' confirmation
3. Module A's hook_requirements() then reports a problem.
4. The user is returned to the module admin page, with the error message from hook_requirements(). Module A is not enabled, however module B *is*.

The expected result would be to return the system to how it was before the attempted operation was begun.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

system.module

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    I tried to follow #13 by adding this to migrate_drupal_ui.install

    /**
     * Implements hook_requirements().
     */
    function migrate_drupal_ui_requirements(string $phase): array {
      $requirements = [];
      if ($phase === 'install') {
        $requirements['migrate_drupal_ui'] = [
          'title' => t('foo'),
          'description' => t('foo'),
          'severity' => Drupal\Core\Extension\Requirement\RequirementSeverity::Error,
        ];
      }
      return $requirements;
    }
    

    But when I hit confirm on the module install form I get the following error:

    TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /data/app/core/lib/Drupal/Component/Render/FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 433 of core/lib/Drupal/Component/Utility/Html.php).

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan
Production build 0.71.5 2024