Fix #3627745: Fix multiple install requirement errors

Changes

On install, core displays the description of each requirement error. If the error also has a value, core shows it as a version number: "(Currently using … version …)". Every error that can come up on install now has a string description and no value. Both requirement classes state this rule in their docblock.

  • RequirementsChecker::checkDatabaseAliasConsistency()
    • Missing logger alias: the message moves from value to description. Without a description, core passed NULL to Html::escape(), which is typed string since 11.0.0. That threw a TypeError on 11.x and 12.x; 10.x showed the message as a version number.
    • logger alias on the same database as another alias: both sentences are joined into the description, instead of one being shown as a version number.
  • MongodbRequirements::checkDatabases(): now sets its own error, like the other check*() methods. A database referencing an undefined client used to have an item list render array as its description, which threw a TypeError on 10.x, 11.x and 12.x. The "undefined client" messages are now joined into a string description. The item list is kept for a valid configuration.
  • MongodbRequirements::checkExtension(): drops the "Extension not loaded" value, which was shown as a version number.
  • MongodbRequirements::checkExtensionVersion(): when the check fails, the version message is now also the description. That error had neither value nor description, so it showed an empty message.

No translatable string changes. On the status report, these errors now show only their description, without the short summary value.

Testing

New kernel tests call drupal_check_module() with the settings for each case and check the exact error messages. They need no MongoDB server.

  • RequirementsCheckerTest: missing logger alias, and logger alias on the same database as another alias.
  • MongodbRequirementsTest: databases referencing undefined clients. It uses two of them, so it also checks that the messages are joined.

Results:

  • On 11.4, without the fix, the new tests fail with the TypeError and the "(Currently using … version …)" message. With the fix they pass.
  • The full module test suite passes on 11.4, and phpstan and phpcs report no errors.
  • The new tests also pass on 12.x.
  • The extension errors have no tests: they need PHP without the extension, or an older version of it.

A client with an empty configuration ('default' => []) is reported as undefined. This behavior predates this MR and is unchanged.

Closes #3627745

AI Disclosure: I used Claude Code to debug and make the code changes for this MR. And to help write the MR description.

Edited by Matt Hand

Merge request reports

Loading
Loading