magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.38k stars 9.29k forks source link

[Issue] Fix table render of DiInfoCommand #38820

Open m2-assistant[bot] opened 1 month ago

m2-assistant[bot] commented 1 month ago

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] commented 1 month ago

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:

engcom-November commented 1 month ago

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.

github-jira-sync-bot commented 1 month ago

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

m2-assistant[bot] commented 1 month ago

: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.

hostep commented 2 weeks ago

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