From 25835bb5cdd696373b7210603a9f5c415f611602 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 22 Dec 2021 11:03:28 +0100 Subject: [PATCH 1/5] Reverting release version changes --- src/Composer/Composer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Composer.php b/src/Composer/Composer.php index ff9aee89d8a5..362ea0bcd39a 100644 --- a/src/Composer/Composer.php +++ b/src/Composer/Composer.php @@ -52,10 +52,10 @@ class Composer * const RELEASE_DATE = '@release_date@'; * const SOURCE_VERSION = '1.8-dev+source'; */ - const VERSION = '2.2.0'; - const BRANCH_ALIAS_VERSION = ''; - const RELEASE_DATE = '2021-12-22 11:03:27'; - const SOURCE_VERSION = ''; + const VERSION = '@package_version@'; + const BRANCH_ALIAS_VERSION = '@package_branch_alias_version@'; + const RELEASE_DATE = '@release_date@'; + const SOURCE_VERSION = '2.2.999-dev+source'; /** * Version number of the internal composer-runtime-api package From 226689b90cbe0a4692a047df19539d4d3e959d79 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 22 Dec 2021 16:04:34 +0100 Subject: [PATCH 2/5] Fix plugin autoloading including files autoload rules from the root package, fixes #10382 (#10386) --- src/Composer/Plugin/PluginManager.php | 11 ++++++++++ .../files_autoload_which_should_not_run.php | 3 +++ .../Test/Plugin/PluginInstallerTest.php | 22 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 tests/Composer/Test/Plugin/Fixtures/files_autoload_which_should_not_run.php diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index c20d403fa927..3f88f6994530 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -216,6 +216,17 @@ public function registerPackage(PackageInterface $package, $failOnMissingClasses $globalRepo = $this->globalComposer !== null ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null; $rootPackage = clone $this->composer->getPackage(); + + // clear files autoload rules from the root package as the root dependencies are not + // necessarily all present yet when booting this runtime autoloader + $rootPackageAutoloads = $rootPackage->getAutoload(); + $rootPackageAutoloads['files'] = array(); + $rootPackage->setAutoload($rootPackageAutoloads); + $rootPackageAutoloads = $rootPackage->getDevAutoload(); + $rootPackageAutoloads['files'] = array(); + $rootPackage->setDevAutoload($rootPackageAutoloads); + unset($rootPackageAutoloads); + $rootPackageRepo = new RootPackageRepository($rootPackage); $installedRepo = new InstalledRepository(array($localRepo, $rootPackageRepo)); if ($globalRepo) { diff --git a/tests/Composer/Test/Plugin/Fixtures/files_autoload_which_should_not_run.php b/tests/Composer/Test/Plugin/Fixtures/files_autoload_which_should_not_run.php new file mode 100644 index 000000000000..392b5bffd593 --- /dev/null +++ b/tests/Composer/Test/Plugin/Fixtures/files_autoload_which_should_not_run.php @@ -0,0 +1,3 @@ +repository + ->expects($this->any()) + ->method('getPackages') + ->will($this->returnValue(array())); + $installer = new PluginInstaller($this->io, $this->composer); + $this->pm->loadInstalledPlugins(); + + $this->autoloadGenerator->setDevMode(true); + $this->composer->getPackage()->setAutoload(array('files' => array(__DIR__ . '/Fixtures/files_autoload_which_should_not_run.php'))); + $this->composer->getPackage()->setDevAutoload(array('files' => array(__DIR__ . '/Fixtures/files_autoload_which_should_not_run.php'))); + $installer->install($this->repository, $this->packages[0]); + + $plugins = $this->pm->getPlugins(); + $this->assertEquals( + 'activate v1'.PHP_EOL, + $this->io->getOutput() + ); + $this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore-line + } + public function testInstallMultiplePlugins() { $this->repository From e1bf45aa8020a801a553768d081a7e8948ceffd6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 22 Dec 2021 21:42:19 +0100 Subject: [PATCH 3/5] Fix issue parsing php files with unterminated comments found inside backticks, fixes #10385 --- src/Composer/Autoload/PhpFileCleaner.php | 1 + .../Test/Autoload/Fixtures/classmap/sameNsMultipleClasses.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/Composer/Autoload/PhpFileCleaner.php b/src/Composer/Autoload/PhpFileCleaner.php index 2564973fcdcc..190d518a68d1 100644 --- a/src/Composer/Autoload/PhpFileCleaner.php +++ b/src/Composer/Autoload/PhpFileCleaner.php @@ -120,6 +120,7 @@ public function clean() } if ($this->peek('*')) { $this->skipComment(); + continue; } } diff --git a/tests/Composer/Test/Autoload/Fixtures/classmap/sameNsMultipleClasses.php b/tests/Composer/Test/Autoload/Fixtures/classmap/sameNsMultipleClasses.php index f92ae8be4522..efd3f1c11fad 100644 --- a/tests/Composer/Test/Autoload/Fixtures/classmap/sameNsMultipleClasses.php +++ b/tests/Composer/Test/Autoload/Fixtures/classmap/sameNsMultipleClasses.php @@ -4,3 +4,5 @@ class A {} class B {} + +$x = `/** unterminated comment`; From 96ecc00a691f9a15ab5c3fcd71c56b3110fd15f4 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 22 Dec 2021 22:20:55 +0100 Subject: [PATCH 4/5] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5fbed5ab4f4..78db398bdff4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### [2.2.1] 2021-12-22 + + * Fixed plugin autoloading including files autoload rules from the root package (#10382) + * Fixed issue parsing php files with unterminated comments found inside backticks (#10385) + ### [2.2.0] 2021-12-22 * Added support for using `dev-main` as the default path repo package version if no VCS info is available (#10372) @@ -1339,6 +1344,7 @@ * Initial release +[2.2.1]: https://github.com/composer/composer/compare/2.2.0...2.2.1 [2.2.0]: https://github.com/composer/composer/compare/2.2.0-RC1...2.2.0 [2.2.0-RC1]: https://github.com/composer/composer/compare/2.1.14...2.2.0-RC1 [2.1.14]: https://github.com/composer/composer/compare/2.1.13...2.1.14 From bbc265e16561ab8e0f5e7cac395ea72640251f0c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 22 Dec 2021 22:21:31 +0100 Subject: [PATCH 5/5] Release 2.2.1 --- src/Composer/Composer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/Composer.php b/src/Composer/Composer.php index 362ea0bcd39a..efbd351a97b9 100644 --- a/src/Composer/Composer.php +++ b/src/Composer/Composer.php @@ -52,10 +52,10 @@ class Composer * const RELEASE_DATE = '@release_date@'; * const SOURCE_VERSION = '1.8-dev+source'; */ - const VERSION = '@package_version@'; - const BRANCH_ALIAS_VERSION = '@package_branch_alias_version@'; - const RELEASE_DATE = '@release_date@'; - const SOURCE_VERSION = '2.2.999-dev+source'; + const VERSION = '2.2.1'; + const BRANCH_ALIAS_VERSION = ''; + const RELEASE_DATE = '2021-12-22 22:21:31'; + const SOURCE_VERSION = ''; /** * Version number of the internal composer-runtime-api package