Notice if update hook has a missing dependency

Created on 24 July 2023, 11 months ago

Problem/Motivation

If an update hook has a dependency declared in a hook_update_dependencies implementation and that dependency doesn't exist yet, a notice is emitted when visiting update.php.

Steps to reproduce

Implement hook_update_dependencies:

/**
 * Implements hook_update_dependencies().
 */
function some_module_update_dependencies() {
  $dependencies = [];
  $dependencies['some_module'][9401] = [
    'user' => 10000,
  ];

  return $dependencies;
}

user_update_10000 is added in Drupal 10. When visiting update.php on Drupal 10 all is fine, but when visiting it using Drupal 9 the following notice is emitted:

Notice: Undefined index: taxonomy_access_fix_updates
Drupal\system\Controller\DbUpdateController->selection()() (Line: 335)

A real-life example can be seen in the following failing test run β†’ of the taxonomy_access_fix module.

Proposed resolution

Fix the broken code.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
SystemΒ  β†’

Last updated 2 days ago

No maintainer
Created by

πŸ‡§πŸ‡ͺBelgium DieterHolvoet Brussels

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024