Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 compatibility - Passing null to parameter #1 ($string) of type string is deprecated - VersionParser.php:105 #134

Closed
laurinkeithdavis opened this issue Apr 1, 2022 · 8 comments

Comments

@laurinkeithdavis
Copy link

C:\jenkins-php-tools>composer update
Loading composer repositories with package information
Deprecation Notice: trim(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/composer/semver/src/VersionParser.php:105

@Seldaek
Copy link
Member

Seldaek commented Apr 1, 2022

Do you have a full stack trace for this? If you run composer with -v it should print it.

@Seldaek Seldaek closed this as completed in 9b2d75f Apr 1, 2022
@Seldaek
Copy link
Member

Seldaek commented Apr 1, 2022

Should be fixed but I'm still interested to see a stack trace if you have one.

@laurinkeithdavis
Copy link
Author

Well, now I can't reproduce it. I apologize, I might have been using a snapshot due to (composer/composer#10631), and this morning I updated composer to 2.3.2.

@Seldaek
Copy link
Member

Seldaek commented Apr 1, 2022

I see, no worries.

@GrahamCampbell
Copy link
Contributor

Isn't the real fix here to fix the caller that is making the invalid call. Not valid to call a function typed as string, with null?

@Seldaek
Copy link
Member

Seldaek commented Apr 4, 2022

Caller has been fixed in composer already, but IMO this is still good to do to mimick a type hint, which would type juggle null into string as well. I don't want to drop 5.3 support just yet in this lib to avoid having to maintain too many branches.

@npurohit
Copy link

I am using version 2.2.6 with PHP8.1.13

Deprecation Notice: trim(): Passing null to parameter #1 ($string) of type string is deprecated in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/composer/semver/src/VersionParser.php:105
Stack trace:
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/PlatformRepository.php:671
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/PlatformRepository.php:239
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:311
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:894
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:428
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:279
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/UpdateCommand.php:248
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:336
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:131
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:83
C:\ProgramData\ComposerSetup\bin\composer.phar:29

@stof
Copy link
Contributor

stof commented Jan 11, 2023

The latest 2.2.x release of Composer is 2.2.18, not 2.2.6. Please try to use the latest version.

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

No branches or pull requests

5 participants