Problem/Motivation
Unable to execute drush aa in Drupal 10.3.6.
Drush version : 13.3.0.0
Steps to reproduce
Execute drush aa and the output generates the following:
Error: Call to undefined method Symfony\Component\Console\Helper\FormatterHelper::strlenWithoutDecoration() in Drupal\site_audit\Renderer\Console->centerText() (line 94 of modules/contrib/site_audit/src/Renderer/Console.php)
Proposed resolution
Make sure strlenWithoutDecoration() is defined or use an alternate method.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | undefined_method-3481856-9.patch | 3.45 KB | uberhacker |
| #8 | undefined_method-3481856-8.patch | 859 bytes | ushma |
Issue fork site_audit-3481856
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 #2
uberhacker commentedComment #3
uberhacker commentedComment #4
ushma commentedComment #6
ushma commentedI have created an MR to replace the deprecated method with removeDecoration(). Attached the patch for the same. Please review.
Comment #7
ushma commentedComment #8
ushma commentedBy mistake uploaded wrong patch above. Please find below the correct patch for the issue.
Comment #9
uberhacker commentedThank you for the patch https://www.drupal.org/u/ushma. Unfortunately, #8 didn't work for me. I have attached another patch that works for Drupal 10.4.5 and Drush 13.4.0.0.
Comment #10
camerongreen commentedJust testing out this module.
Running the first command on https://www.drupal.org/project/site_audit says "Command ac is not defined":
drush ac --html --detail > ~/Desktop/report.html
First command in Readme.md "drush site_audit:audit" or any of the Examples from drush audit -h such as "drush audit watchdog" returns an error 'The "report" argument does not exist'.
If I try "drush audit:list" to find a valid report I get the error listed in this issue.
I like the concept for a module, but seems unusable.
Comment #11
romainj commentedPatch #9 works for me. Thanks
Comment #12
mattybThanks UberHacker Patch #9 worked for me using Drupal: 10.3.13, PHP 8.3
Comment #13
the_g_bomb commentedI have applied this patch as a part of a patch cocktail to get site_audit working locally.
I can confirm this patch resolves the issue we were experiencing.
### Environment:
- Drupal 10.4.8
- Site Audit: 4.0.x-dev
### Error Before Patch:
### After Applying Patch:
The error is resolved. The patch correctly updates the code to use `Helper::removeDecoration()` instead of the deprecated `FormatterHelper::strlenWithoutDecoration()` method. This ensures compatibility with current versions of Symfony Console component.
Comment #14
froboyI applied the patch from #9 and ran into another error:
The
TypeErrorhappens becauseSymfony\Component\Console\Helper\Table::render()returnsvoid, and the code passed that intowriteln().I fixed both occurrences in src/Renderer/Console.php:
src/Renderer/Console.php:195src/Renderer/Console.php:268Comment #17
froboyThanks all. Merged to 4.x. Release pending.
Comment #18
froboy