Problem/Motivation

  • Core 9.4.1
  • php 8.0
  • Monitoring 8.x-1.11
  • Drush Commandline Tool 10.6.1

Updating our core to 9.4 and running php 8.0 we are now getting errors when doing a `drush monitoring-run` command. I think it has something to do with the table format in the drush console?

ValueError: wordwrap(): Argument #4 ($cut_long_words) cannot be true when argument #2 ($width) is 0 in wordwrap() (line 140 of /vendor/consolidation/output-formatters/src/Transformations/WordWrapper.php).

Steps to reproduce

1. Update core to Drupal 9.4 with PHP 8.0
2. Run `drush monitoring-run` and see error in console.

Proposed resolution

I really don't know since its very hard to even find out what is calling this, the stack trace is not helpful.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

NicholasS created an issue.

nicholass’s picture

So digging into this, I see the the modules drush uses drush_print_table() a few times an only once with a TRUE for the second parameter. That TRUE seems like line up with my error message.

drush_print_table($rows, TRUE);

Another oddity is I ran across some other module which seems to indicate this was removed in Drush 9 ? But I am pretty sure I am on Drush 10 and its working so not sure what to make of that.
https://www.drupal.org/project/migrate_tools/issues/2940847

nicholass’s picture

But I do think the stack trace is indicating the issue might be with Drush, drush seems to use the "consolidation/output-formatters"

nicholass’s picture

It would also seem the whole drush.inc file needs to be reworked for Drupal 9 see related issue: https://www.drupal.org/project/behat_ui/issues/3214404

nicholass’s picture

As an update: This seems error seems to no longer be breaking our scheduled task, but still shows in the logs. So I guess its just an annoyance for now. And with the `--watchdog=disable` flag I can keep it out of the logs.

And my previous links talking about druah_print_table() usage I discovered that is probably Drupal 8 drush logic, the Drupal 9 logic is here https://git.drupalcode.org/project/monitoring/-/blob/8.x-1.x/src/Command... and there is no drush_print_table() usage. So this is basically unused D8 code I guess in the drush.inc?

nicholass’s picture

Here is a full stack trace if it helps anyone find the root issue, I suspect its one of my sensors that maybe don't have a column or something for the table output?

	ValueError: wordwrap(): Argument #4 ($cut_long_words) cannot be true when argument #2 ($width) is 0 in wordwrap() (line 140 of /mnt/www/html/drupal9/vendor/consolidation/output-formatters/src/Transformations/WordWrapper.php)
#0 /mnt/www/html/drupal9/vendor/consolidation/output-formatters/src/Transformations/WordWrapper.php(140): wordwrap()
#1 /mnt/www/html/drupal9/vendor/consolidation/output-formatters/src/Transformations/WordWrapper.php(95): Consolidation\OutputFormatters\Transformations\WordWrapper->wrapCell()
#2 /mnt/www/html/drupal9/vendor/consolidation/output-formatters/src/Formatters/TableFormatter.php(127): Consolidation\OutputFormatters\Transformations\WordWrapper->wrap()
#3 /mnt/www/html/drupal9/vendor/consolidation/output-formatters/src/Formatters/TableFormatter.php(105): Consolidation\OutputFormatters\Formatters\TableFormatter->wrap()
#4 /mnt/www/html/drupal9/vendor/consolidation/output-formatters/src/FormatterManager.php(241): Consolidation\OutputFormatters\Formatters\TableFormatter->write()
#5 /mnt/www/html/drupal9/vendor/consolidation/annotated-command/src/ResultWriter.php(157): Consolidation\OutputFormatters\FormatterManager->write()
#6 /mnt/www/html/drupal9/vendor/consolidation/annotated-command/src/ResultWriter.php(88): Consolidation\AnnotatedCommand\ResultWriter->writeUsingFormatter()
#7 /mnt/www/html/drupal9/vendor/consolidation/annotated-command/src/CommandProcessor.php(246): Consolidation\AnnotatedCommand\ResultWriter->handle()
#8 /mnt/www/html/drupal9/vendor/consolidation/annotated-command/src/CommandProcessor.php(180): Consolidation\AnnotatedCommand\CommandProcessor->handleResults()
#9 /mnt/www/html/drupal9/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process()
#10 /mnt/www/html/drupal9/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#11 /mnt/www/html/drupal9/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run()
#12 /mnt/www/html/drupal9/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#13 /mnt/www/html/drupal9/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#14 /mnt/www/html/drupal9/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run()
#15 /mnt/www/html/drupal9/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun()
#16 /mnt/www/html/drupal9/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run()
#17 /mnt/www/html/drupal9/vendor/drush/drush/drush(4): require('...')
#18 {main}
berdir’s picture

RowsOfFields is the replacement for drush_print_table(), it's not a direct call because we return the object and then drush calls the code that does the actual thing. But yes you'll need to debug it to see on what exactly it has a problem.