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
loggeralias: the message moves fromvaluetodescription. Without adescription, core passedNULLtoHtml::escape(), which is typedstringsince 11.0.0. That threw aTypeErroron 11.x and 12.x; 10.x showed the message as a version number. loggeralias on the same database as another alias: both sentences are joined into thedescription, instead of one being shown as a version number.
- Missing
MongodbRequirements::checkDatabases(): now sets its own error, like the othercheck*()methods. A database referencing an undefined client used to have an item list render array as itsdescription, which threw aTypeErroron 10.x, 11.x and 12.x. The "undefined client" messages are now joined into a stringdescription. 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 thedescription. That error had neithervaluenordescription, 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: missingloggeralias, andloggeralias 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
TypeErrorand 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.