sbuerk / typo3-cmscomposerinstallers-testingframework-bridge

Intermediate Bridge for CMS Composer Installers 5 and Testing Framework for extension development
GNU General Public License v2.0
5 stars 1 forks source link

Exception is thrown by TypeError in ShowCommand.php when using composer show --tree #9

Closed sypets closed 1 year ago

sypets commented 1 year ago

Reproduce

Minimal:

composer init 
....
composer require sbuerk/typo3-cmscomposerinstallers-testingframework-bridge:dev-main --dev
composer show --tree 
composer --version
Composer version 2.3.8 2022-07-01 12:10:47

Also, composer validate shows description is missing:

composer validate
...
# Publish errors
- description : The property description is required

I first noticed this because I wanted to see the dev dependencies in brotkrueml/schema, so I used the command there (that extension requires sbuerk/typo3-cmscomposerinstallers-testingframework-bridge) and saw the exception.

Code

ShowCommand.php:

1073 $io->write(' ' . strtok($package['description'], "\r\n"));

https://github.com/composer/composer/blob/2.3.8/src/Composer/Command/ShowCommand.php#L1073

Reason

I think the reason is that the description is missing in composer.json. Adding a description seems to fix it. Will create PR.

Exception

sbuerk/typo3-cmscomposerinstallers-testingframework-bridge 9999999-dev
In ShowCommand.php line 1073:

  [TypeError]                                                         
  strtok(): Argument #1 ($string) must be of type string, null given  

Exception trace:
  at phar:///usr/bin/composer/src/Composer/Command/ShowCommand.php:1073
 strtok() at phar:///usr/bin/composer/src/Composer/Command/ShowCommand.php:1073
 Composer\Command\ShowCommand->displayPackageTree() at phar:///usr/bin/composer/src/Composer/Command/ShowCommand.php:343
 Composer\Command\ShowCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:1024
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:335
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:88
 require() at /usr/bin/composer:29
sypets commented 1 year ago

Rechecked with newer Composer version (2.5.5). Then, the problem does not occur. (However, might still be good to fix, regardless).