From 008c8ed11aced8fdd5e217cdbe8a69787230a6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=BClke?= Date: Fri, 21 Jul 2023 11:06:03 +0200 Subject: [PATCH] Fix lib-curl-openssl parsing for SecureTransport (#11534) On macOS, if libcurl is built against SecureTransport, the platform repository will contain an invalid package name: % composer show --platform | grep curl ext-curl 8.2.7 The curl PHP extension lib-curl 8.1.2 The curl library lib-curl-(securetransport) openssl 3.1.1 curl (securetransport) openss... lib-curl-libssh2 1.11.0 curl libssh2 version lib-curl-zlib 1.2.11 curl zlib version This change fixes it: % bin/composer show --platform | grep curl lib-curl 8.1.2 The curl library lib-curl-libssh2 1.11.0 curl libssh2 version lib-curl-securetransport 3.1.1 curl (securetransport) openssl ... lib-curl-zlib 1.2.11 curl zlib version (second column width difference comes from the Composer dev version number) --- src/Composer/Repository/PlatformRepository.php | 7 ++++++- tests/Composer/Test/Repository/PlatformRepositoryTest.php | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 916145ee1..19a1c940b 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -238,7 +238,12 @@ class PlatformRepository extends ArrayRepository $parsedVersion = Version::parseOpenssl($sslMatches['version'], $isFips); $this->addLibrary($name.'-openssl'.($isFips ? '-fips' : ''), $parsedVersion, 'curl OpenSSL version ('.$parsedVersion.')', array(), $isFips ? array('curl-openssl') : array()); } else { - $this->addLibrary($name.'-'.$library, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', array('curl-openssl')); + if ($library === '(securetransport) openssl') { + $shortlib = 'securetransport'; + } else { + $shortlib = $library; + } + $this->addLibrary($name.'-'.$shortlib, $sslMatches['version'], 'curl '.$library.' version ('.$sslMatches['version'].')', array('curl-openssl')); } } diff --git a/tests/Composer/Test/Repository/PlatformRepositoryTest.php b/tests/Composer/Test/Repository/PlatformRepositoryTest.php index ca95ae556..ffcbdc541 100644 --- a/tests/Composer/Test/Repository/PlatformRepositoryTest.php +++ b/tests/Composer/Test/Repository/PlatformRepositoryTest.php @@ -376,7 +376,6 @@ libSSH Version => libssh2/1.4.1', 'curl: libssh not libssh2' => array( 'curl', ' - curl cURL support => enabled