PHP Warning when ModulesListConfirmForm::buildMessageList() relies on module that has been unset within ModulesListForm::buildModuleList()

Created on 20 February 2024, about 1 year ago
Updated 3 July 2024, 8 months ago

Problem/Motivation

When implementing hook_requirements() using 'severity' => REQUIREMENT_ERROR during install phase within a module and drupal_check_module() fails and the module is unset from installed modules within ModulesListForm::buildModuleList(), a PHP Warning occurs b/c ModulesListConfirmForm::buildMessageList() relies on the installed modules array item here.

I suppose the underlying issue is that a module's dependencies continue to be installed regardless if the selected module can not be installed.

Steps to reproduce

  • Implement hook_requirements() using install phase ensuring the condition results in REQUIREMENT_ERROR severity.
  • Ensure the module where the implementing the hook_requirements() has a dependency that has yet to be installed.
  • Go to /admin/modules and attempt to install the module with the hook_requirements() implementation
  • Observe PHP Warning

Proposed resolution

TBD -

  • Perform the drupal_check_module() before adding dependencies
  • unset $modules['dependencies'][$module] and remove $module's dependencies from $module['install] to prevent them from being installed as well.

Remaining tasks

  • Create a failing test to illustrate the issue
  • Get consensus on the underlying issue
  • Get consensus on on the resolution
  • Fix and add/update test(s) as needed

User interface changes

If drupal_check_module() is performed before adding dependencies, there is a UI change in that a user will not see the confirmation form and messaging related to installing module dependencies.

API changes

N/A

Data model changes

N/A

Release notes snippet

TBD

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
InstallΒ  β†’

Last updated 10 days ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States jasonawant New Orleans, USA

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

Comments & Activities

Production build 0.71.5 2024