Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ktomk
Copy link
Contributor

@ktomk ktomk commented Jun 30, 2022

Fix string type requirement in case of NULL value:

[TypeError]                                                                                                                                                                  
Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345

Fix string type requirement in case of NULL value:

    [TypeError]                                                                                                                                                                  
    Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
@ktomk
Copy link
Contributor Author

ktomk commented Jun 30, 2022

The previous line 344 ternary shorthand lets NULL $author pass on empty input value, propagating NULL to $author parameter which throws the TypeError.

Fix is to fall-through by null-coalescing operator to empty string (zero length string).

@ktomk
Copy link
Contributor Author

ktomk commented Jun 30, 2022

Fix not necessary in 2.2 / 1.10.

@Seldaek Seldaek added this to the 2.3 milestone Jul 1, 2022
@Seldaek
Copy link
Member

Seldaek commented Jul 1, 2022

Thanks

@Seldaek Seldaek merged commit 7adcf9f into composer:2.3 Jul 1, 2022
Seldaek pushed a commit that referenced this pull request Jul 1, 2022
Fix string type requirement in case of NULL value:

    [TypeError]                                                                                                                                                                  
    Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
Seldaek pushed a commit that referenced this pull request Jul 1, 2022
Fix string type requirement in case of NULL value:

    [TypeError]                                                                                                                                                                  
    Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
emahorvat52 pushed a commit to emahorvat52/composer that referenced this pull request Feb 3, 2023
Fix string type requirement in case of NULL value:

    [TypeError]                                                                                                                                                                  
    Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
emahorvat52 pushed a commit to emahorvat52/composer that referenced this pull request Feb 3, 2023
Fix string type requirement in case of NULL value:

    [TypeError]                                                                                                                                                                  
    Composer\Command\InitCommand::parseAuthorString(): Argument #1 ($author) must be of type string, null given, called in phar:///composer.phar/src/Composer/Command/InitCommand.php on line 345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants