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

[2.3.0RC1] Return value must be of type string, bool returned in /usr/share/php/Composer/Platform/Runtime.php:101 #10631

Closed
remicollet opened this issue Mar 17, 2022 · 7 comments
Labels
Milestone

Comments

@remicollet
Copy link
Contributor

@remicollet remicollet commented Mar 17, 2022

When awscrt extension is installed

$ composer install
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
Loading composer repositories with package information

Fatal error: Uncaught TypeError: Composer\Platform\Runtime::getExtensionVersion(): Return value must be of type string, bool returned in /usr/share/php/Composer/Platform/Runtime.php:101
Stack trace:
#0 /usr/share/php/Composer/Repository/PlatformRepository.php(196): Composer\Platform\Runtime->getExtensionVersion('awscrt')
#1 /usr/share/php/Composer/Repository/ArrayRepository.php(311): Composer\Repository\PlatformRepository->initialize()
#2 /usr/share/php/Composer/Installer.php(899): Composer\Repository\ArrayRepository->getPackages()
#3 /usr/share/php/Composer/Installer.php(428): Composer\Installer->createRequest(Object(Composer\Package\RootPackage), Object(Composer\Repository\PlatformRepository), NULL)
#4 /usr/share/php/Composer/Installer.php(279): Composer\Installer->doUpdate(Object(Composer\Repository\InstalledFilesystemRepository), true)
#5 /usr/share/php/Composer/Command/InstallCommand.php(137): Composer\Installer->run()
#6 /usr/share/php/Composer/vendor/symfony/console/Command/Command.php(298): Composer\Command\InstallCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /usr/share/php/Composer/vendor/symfony/console/Application.php(1015): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /usr/share/php/Composer/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Composer\Command\InstallCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /usr/share/php/Composer/Console/Application.php(332): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /usr/share/php/Composer/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /usr/share/php/Composer/Console/Application.php(128): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /usr/bin/composer(84): Composer\Console\Application->run()
#13 {main}
  thrown in /usr/share/php/Composer/Platform/Runtime.php on line 101

And

$ php -r 'var_dump(phpversion("awscrt"));'
bool(false)

@remicollet remicollet changed the title Return value must be of type string, bool returned in /usr/share/php/Composer/Platform/Runtime.php:101 [2.3.0RC1] Return value must be of type string, bool returned in /usr/share/php/Composer/Platform/Runtime.php:101 Mar 17, 2022
@Seldaek Seldaek added this to the 2.3 milestone Mar 17, 2022
@Seldaek Seldaek added the Bug label Mar 17, 2022
@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 17, 2022

Thanks for the exotic find :)

@laurinkeithdavis
Copy link

@laurinkeithdavis laurinkeithdavis commented Mar 30, 2022

This change has completely broken composer for us:

composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.

In PlatformRepository.php line 669:

  [TypeError]
  Composer\Repository\PlatformRepository::addLibrary(): Argument #2 ($prettyVersion) must be of type string, null given, called in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/PlatformRepository
  .php on line 243


Exception trace:
  at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/PlatformRepository.php:669
 Composer\Repository\PlatformRepository->addLibrary() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/PlatformRepository.php:243
 Composer\Repository\PlatformRepository->initialize() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:311
 Composer\Repository\ArrayRepository->getPackages() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:899
 Composer\Installer->createRequest() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:675
 Composer\Installer->doInstall() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:281
 Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/InstallCommand.php:137
 Composer\Command\InstallCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:1015
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:334
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:83
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:29

@laurinkeithdavis
Copy link

@laurinkeithdavis laurinkeithdavis commented Mar 30, 2022

I've tested this on various projects, including the composer project itself, same result. Versified installed composer version:

C:\inetpub\composer>composer --version
Composer 2.3.1 2022-03-30 15:41:28

@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 30, 2022

@laurinkeithdavis can you put this in a test.php file and run it and share the output?

        $reflector = new \ReflectionExtension('curl');
        $reflector->info();

@laurinkeithdavis
Copy link

@laurinkeithdavis laurinkeithdavis commented Mar 30, 2022

C:\inetpub\test>php test.php

curl

cURL support => enabled
cURL Information => 7.80.0
Age => 9
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => No
SPNEGO => Yes
SSL => Yes
SSPI => Yes
TLS-SRP => No
HTTP2 => Yes
GSSAPI => No
KERBEROS5 => Yes
UNIX_SOCKETS => Yes
PSL => No
HTTPS_PROXY => Yes
MULTI_SSL => Yes
BROTLI => No
Protocols => dict, file, ftp, ftps, gopher, gophers, http, https, imap, imaps, ldap, ldaps, mqtt, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host => x86_64-pc-win32
SSL Version => OpenSSL/1.1.1l (Schannel)
ZLib Version => 1.2.11
libSSH Version => libssh2/1.9.0

Directive => Local Value => Master Value
curl.cainfo => c:\PHP\cacert.pem => c:\PHP\cacert.pem

Seldaek added a commit that referenced this issue Mar 30, 2022
@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 30, 2022

@laurinkeithdavis ok thanks, see the commits linked above, please try with composer self-update --snapshot if it fixes it for you.

@laurinkeithdavis
Copy link

@laurinkeithdavis laurinkeithdavis commented Mar 30, 2022

Yes, it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants