diff --git a/CHANGELOG.md b/CHANGELOG.md index 2254fafdf..ff1b0a09f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,6 +84,16 @@ * Fixed symlink creation in linux VM guest filesystems to be recognized by Windows (#10592) * Performance improvement in pool optimization step (#10585) +### [2.2.14] 2022-06-06 + + * Fixed handling of broken symlinks when checking whether a package is still installed (#6708) + * Fixed name validation regex in schema causing issues with JS IDEs like VS Code (#10811) + * Fixed bin proxies to allow a proxy to include another one safely (#10823) + * Fixed gitlab-token JSON schema definition (#10800) + * Fixed openssl 3.x version parsing as it is now semver compliant + * Fixed type error when a json file cannot be read (#10818) + * Fixed parsing of multi-line arrays in funding.yml (#10784) + ### [2.2.13] 2022-05-25 * Fixed invalid credentials loop when setting up GitLab token (#10748) @@ -1531,6 +1541,7 @@ [2.3.0]: https://github.com/composer/composer/compare/2.3.0-RC2...2.3.0 [2.3.0-RC2]: https://github.com/composer/composer/compare/2.3.0-RC1...2.3.0-RC2 [2.3.0-RC1]: https://github.com/composer/composer/compare/2.2.9...2.3.0-RC1 +[2.2.14]: https://github.com/composer/composer/compare/2.2.13...2.2.14 [2.2.13]: https://github.com/composer/composer/compare/2.2.12...2.2.13 [2.2.12]: https://github.com/composer/composer/compare/2.2.11...2.2.12 [2.2.11]: https://github.com/composer/composer/compare/2.2.10...2.2.11 diff --git a/phpstan/baseline.neon b/phpstan/baseline.neon index 32b12b276..9e8614240 100644 --- a/phpstan/baseline.neon +++ b/phpstan/baseline.neon @@ -2970,11 +2970,6 @@ parameters: count: 1 path: ../src/Composer/Json/JsonFile.php - - - message: "#^Parameter \\#1 \\$json of static method Composer\\\\Json\\\\JsonFile\\:\\:parseJson\\(\\) expects string\\|null, string\\|false\\|null given\\.$#" - count: 1 - path: ../src/Composer/Json/JsonFile.php - - message: "#^Parameter \\#1 \\$json of static method Composer\\\\Json\\\\JsonFile\\:\\:validateSyntax\\(\\) expects string, string\\|false given\\.$#" count: 1 diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index fc1d5d7a1..11f561fbb 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -379,7 +379,10 @@ if (PHP_VERSION_ID < 80000) { } } - if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) { + if ( + (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) + || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) + ) { include("phpvfscomposer://" . $binPathExported); exit(0); } diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 925839f53..55c190d99 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -91,7 +91,19 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface return true; } - return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath); + if (Platform::isWindows() && $this->filesystem->isJunction($installPath)) { + return true; + } + + if (is_link($installPath)) { + if (realpath($installPath) === false) { + return false; + } + + return true; + } + + return false; } /** diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 44e37932f..22f1e8f67 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -114,6 +114,10 @@ class JsonFile throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage()); } + if ($json === false) { + throw new \RuntimeException('Could not read '.$this->path); + } + return static::parseJson($json, $this->path); } diff --git a/src/Composer/Platform/Version.php b/src/Composer/Platform/Version.php index 6e5dba216..053ca716b 100644 --- a/src/Composer/Platform/Version.php +++ b/src/Composer/Platform/Version.php @@ -32,11 +32,16 @@ class Version return null; } + // OpenSSL 1 used 1.2.3a style versioning, 3+ uses semver + $patch = ''; + if (version_compare($matches['version'], '3.0.0', '<')) { + $patch = '.'.self::convertAlphaVersionToIntVersion($matches['patch']); + } + $isFips = strpos($matches['suffix'], 'fips') !== false; $suffix = strtr('-'.ltrim($matches['suffix'], '-'), array('-fips' => '', '-pre' => '-alpha')); - $patch = self::convertAlphaVersionToIntVersion($matches['patch']); - return rtrim($matches['version'].'.'.$patch.$suffix, '-'); + return rtrim($matches['version'].$patch.$suffix, '-'); } /** diff --git a/src/Composer/Repository/Vcs/GitHubDriver.php b/src/Composer/Repository/Vcs/GitHubDriver.php index 0e60070bb..d22b553ff 100644 --- a/src/Composer/Repository/Vcs/GitHubDriver.php +++ b/src/Composer/Repository/Vcs/GitHubDriver.php @@ -234,6 +234,10 @@ class GitHubDriver extends VcsDriver foreach (Preg::split('{\r?\n}', $funding) as $line) { $line = trim($line); if (Preg::isMatch('{^(\w+)\s*:\s*(.+)$}', $line, $match)) { + if ($match[2] === '[') { + $key = $match[1]; + continue; + } if (Preg::isMatch('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) { foreach (array_map('trim', Preg::split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) { $result[] = array('type' => $match[1], 'url' => trim($item, '"\' ')); @@ -244,8 +248,13 @@ class GitHubDriver extends VcsDriver $key = null; } elseif (Preg::isMatch('{^(\w+)\s*:\s*#\s*$}', $line, $match)) { $key = $match[1]; - } elseif ($key && Preg::isMatch('{^-\s*(.+)(\s+#.*)?$}', $line, $match)) { + } elseif ($key && ( + Preg::isMatch('{^-\s*(.+)(\s+#.*)?$}', $line, $match) + || Preg::isMatch('{^(.+),(\s*#.*)?$}', $line, $match) + )) { $result[] = array('type' => $key, 'url' => trim($match[1], '"\' ')); + } elseif ($key && $line === ']') { + $key = null; } } diff --git a/tests/Composer/Test/Platform/VersionTest.php b/tests/Composer/Test/Platform/VersionTest.php index c6ed62ecd..d709bd1ab 100644 --- a/tests/Composer/Test/Platform/VersionTest.php +++ b/tests/Composer/Test/Platform/VersionTest.php @@ -70,6 +70,9 @@ class VersionTest extends TestCase array('1.2.3za', '1.2.3.27'), array('1.2.3zy', '1.2.3.51'), array('1.2.3zz', '1.2.3.52'), + // 3.x + array('3.0.0', '3.0.0', false, '3.0.0.0'), + array('3.2.4-dev', '3.2.4-dev', false, '3.2.4.0-dev'), ); }