From 45e998c1d592674ee90f3e41e7df616b018e299a Mon Sep 17 00:00:00 2001 From: Richard Fussenegger Date: Wed, 6 Jul 2016 18:59:03 +0200 Subject: [PATCH 1/4] Reverted to initial version --- .../Repository/PlatformRepository.php | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 02d668469..6e52a38e7 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -12,9 +12,8 @@ namespace Composer\Repository; -use Composer\Config; -use Composer\Package\PackageInterface; use Composer\Package\CompletePackage; +use Composer\Package\PackageInterface; use Composer\Package\Version\VersionParser; use Composer\Plugin\PluginInterface; use Composer\Util\Silencer; @@ -78,21 +77,29 @@ class PlatformRepository extends ArrayRepository $version = $versionParser->normalize($prettyVersion); } + // The AF_INET6 constant is only defined if ext-sockets is available but IPv6 support might still be available. + $ipv6Support = defined('AF_INET6') || @inet_pton('::') !== false; + $php = new CompletePackage('php', $version, $prettyVersion); $php->setDescription('The PHP interpreter'); $this->addPackage($php); + if ($ipv6Support) { + $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion); + $phpIpv6->setDescription('The PHP interpreter with IPv6 support'); + $this->addPackage($phpIpv6); + } + if (PHP_INT_SIZE === 8) { $php64 = new CompletePackage('php-64bit', $version, $prettyVersion); $php64->setDescription('The PHP interpreter, 64bit'); $this->addPackage($php64); - } - // The AF_INET6 constant is only defined if ext-sockets is available but IPv6 support might still be available. - if (defined('AF_INET6') || (function_exists('inet_pton') && Silencer::call('inet_pton', '::') !== false)) { - $phpIpv6 = new CompletePackage('ext-network-ipv6', $version, $prettyVersion); - $phpIpv6->setDescription('PHP IPv6 support'); - $this->addPackage($phpIpv6); + if ($ipv6Support) { + $php64Ipv6 = new CompletePackage('php-64bit-ipv6', $version, $prettyVersion); + $php64Ipv6->setDescription('The PHP interpreter with IPV6 support, 64bit'); + $this->addPackage($php64Ipv6); + } } $loadedExtensions = get_loaded_extensions(); From a155f4e7ea8ae30da6c48dcf9228fc6439ba7e23 Mon Sep 17 00:00:00 2001 From: Richard Fussenegger Date: Wed, 6 Jul 2016 19:00:44 +0200 Subject: [PATCH 2/4] Removed unused Silencer import --- src/Composer/Repository/PlatformRepository.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 6e52a38e7..af8b9d232 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -16,7 +16,6 @@ use Composer\Package\CompletePackage; use Composer\Package\PackageInterface; use Composer\Package\Version\VersionParser; use Composer\Plugin\PluginInterface; -use Composer\Util\Silencer; /** * @author Jordi Boggiano From 14224a1f029200edcee44401c28b882e30e19485 Mon Sep 17 00:00:00 2001 From: Richard Fussenegger Date: Wed, 6 Jul 2016 22:05:08 +0200 Subject: [PATCH 3/4] Reduced to single requirement --- .../Repository/PlatformRepository.php | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index af8b9d232..db75eb564 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -76,29 +76,22 @@ class PlatformRepository extends ArrayRepository $version = $versionParser->normalize($prettyVersion); } - // The AF_INET6 constant is only defined if ext-sockets is available but IPv6 support might still be available. - $ipv6Support = defined('AF_INET6') || @inet_pton('::') !== false; - $php = new CompletePackage('php', $version, $prettyVersion); $php->setDescription('The PHP interpreter'); $this->addPackage($php); - if ($ipv6Support) { - $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion); - $phpIpv6->setDescription('The PHP interpreter with IPv6 support'); - $this->addPackage($phpIpv6); - } - if (PHP_INT_SIZE === 8) { $php64 = new CompletePackage('php-64bit', $version, $prettyVersion); $php64->setDescription('The PHP interpreter, 64bit'); $this->addPackage($php64); + } - if ($ipv6Support) { - $php64Ipv6 = new CompletePackage('php-64bit-ipv6', $version, $prettyVersion); - $php64Ipv6->setDescription('The PHP interpreter with IPV6 support, 64bit'); - $this->addPackage($php64Ipv6); - } + // The AF_INET6 constant is only defined if ext-sockets is available but + // IPv6 support might still be available. + if (defined('AF_INET6') || @inet_pton('::') !== false) { + $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion); + $phpIpv6->setDescription('The PHP interpreter with IPv6 support'); + $this->addPackage($phpIpv6); } $loadedExtensions = get_loaded_extensions(); From 560f09cf3c0b09aacdd425e0825c8977bed17ea1 Mon Sep 17 00:00:00 2001 From: Richard Fussenegger Date: Thu, 7 Jul 2016 08:25:46 +0200 Subject: [PATCH 4/4] Changed error suppression to Silencer --- src/Composer/Repository/PlatformRepository.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index db75eb564..b080e9bdd 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -16,6 +16,7 @@ use Composer\Package\CompletePackage; use Composer\Package\PackageInterface; use Composer\Package\Version\VersionParser; use Composer\Plugin\PluginInterface; +use Composer\Util\Silencer; /** * @author Jordi Boggiano @@ -88,7 +89,7 @@ class PlatformRepository extends ArrayRepository // The AF_INET6 constant is only defined if ext-sockets is available but // IPv6 support might still be available. - if (defined('AF_INET6') || @inet_pton('::') !== false) { + if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) { $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion); $phpIpv6->setDescription('The PHP interpreter with IPv6 support'); $this->addPackage($phpIpv6);