Problem/Motivation
I got the following fatal when i tried to run audit_status:
TypeError: Drupal\audit_status\Plugin\AuditAnalyzer\StatusAnalyzer::buildRequirementResultItem(): Argument #3 ($severity) must be of type int, Drupal\Core\Extension\Requirement\RequirementSeverity given, called in /var/www/html/web/modules/contrib/audit/modules/audit_status/src/Plugin/AuditAnalyzer/StatusAnalyzer.php on line 3458 in Drupal\audit_status\Plugin\AuditAnalyzer\StatusAnalyzer->buildRequirementResultItem() (line 3511 of modules/contrib/audit/modules/audit_status/src/Plugin/AuditAnalyzer/StatusAnalyzer.php).
Steps to reproduce
Happens on a fresh audit install on a Drupal 11.
Proposed resolution
Convert RequirementSeverity to int.
Issue fork audit-3585438
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
harlor commentedComment #5
trebormcHi @harlor,
Thanks for the report. To be honest, this is a bit unexpected on a fresh Drupal 11 install. I run this module on several Drupal 11 sites and have never seen this fatal, and as far as I understand the new `RequirementSeverity` enum is only a deprecation in 11.x (legacy int severities are still accepted by core until Drupal 12), so it shouldn't be breaking anything yet on a vanilla setup. It probably means one of the enabled modules on your site has already migrated its `hook_requirements()` to return the enum form.
In any case, I've just landed a variant of your patch on `1.x` that normalizes both forms (legacy int and the new `RequirementSeverity` enum) at a single point in `analyzeSystemRequirements()`, plus a regression unit test. It will go out in the next release.
I'm closing this as fixed. If you still see the fatal after upgrading, please reopen and I'll dig deeper.
Thanks again!
Comment #7
trebormc