magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

[Issue] Fix table render of DiInfoCommand

Open m2-assistant[bot] opened this issue 1 year ago • 5 comments
trafficstars

This issue is automatically created based on existing pull request: magento/magento2#38813: Fix table render of DiInfoCommand


When running the DiInfoCommand under Magento 2.4.7 and PHP 8.3, line 96 mentions to pass the output of $paramsTable->render() to the $output. However, because of typing issues, this causes a Fatal Error. According the Symfony docs (since a long time) the render() method is already giving output, so the output should not be passed to $output->writeln() anyway. This PR fixes things.

m2-assistant[bot] avatar Jun 11 '24 11:06 m2-assistant[bot]

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jun 12 '24 07:06 m2-assistant[bot]

Hello @jissereitsma,

Thank you for the report and collaboration!

Verified this on 2.4-develop with php 8.3. When running bin/magento dev:di:info "<class-namespace>" we are getting below error:

There is an error in /opt/homebrew/var/www/magento8/vendor/symfony/console/Output/Output.php at line: 109
Symfony\Component\Console\Output\Output::writeln(): Argument #1 ($messages) must be of type Traversable|array|string, null given, called in /opt/homebrew/var/www/magento8/app/code/Magento/Developer/Console/Command/DiInfoCommand.php on line 96#0 /opt/homebrew/var/www/magento8/app/code/Magento/Developer/Console/Command/DiInfoCommand.php(96): Symfony\Component\Console\Output\Output->writeln(NULL)
#1 /opt/homebrew/var/www/magento8/app/code/Magento/Developer/Console/Command/DiInfoCommand.php(167): Magento\Developer\Console\Command\DiInfoCommand->printConstructorArguments('Magento\\Quote\\M...', Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /opt/homebrew/var/www/magento8/vendor/symfony/console/Command/Command.php(326): Magento\Developer\Console\Command\DiInfoCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /opt/homebrew/var/www/magento8/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /opt/homebrew/var/www/magento8/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Developer\Console\Command\DiInfoCommand\Interceptor->___callParent('run', Array)
#5 /opt/homebrew/var/www/magento8/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Developer\Console\Command\DiInfoCommand\Interceptor->Magento\Framework\Interception\{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /opt/homebrew/var/www/magento8/generated/code/Magento/Developer/Console/Command/DiInfoCommand/Interceptor.php(77): Magento\Developer\Console\Command\DiInfoCommand\Interceptor->___callPlugins('run', Array, Array)
#7 /opt/homebrew/var/www/magento8/vendor/symfony/console/Application.php(1078): Magento\Developer\Console\Command\DiInfoCommand\Interceptor->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /opt/homebrew/var/www/magento8/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Magento\Developer\Console\Command\DiInfoCommand\Interceptor), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /opt/homebrew/var/www/magento8/lib/internal/Magento/Framework/Console/Cli.php(118): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /opt/homebrew/var/www/magento8/vendor/symfony/console/Application.php(175): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /opt/homebrew/var/www/magento8/bin/magento(23): Symfony\Component\Console\Application->run()
#12 {main}

This is due to the parameter being passed to Output::writeln should be of Traversable|array|string. Since the render() function renders the output by default there is no need to pass it to Output::writeln.

Note: There is a render function being passed to Output::writeln in line number 145 as well. it would be great if you could remove Output::writeln in line 145.

Hence confirming the issue.

Thank you.

engcom-November avatar Jun 12 '24 07:06 engcom-November

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12120 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jun 12 '24 09:06 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Jun 12 '24 09:06 m2-assistant[bot]

This one can be closed as it duplicates https://github.com/magento/magento2/issues/38740

hostep avatar Jun 27 '24 08:06 hostep