composer: Fatal error in newest version from composer

We are having problems with the version 2.2.0 from composer. I created the a minimal reproduction below. With version 2.1.14 this doesn’t happen.

My composer.json:

{
	"autoload": {
		"files": [
			"app/AppKernel.php"
		]
	},
	"require": {
		"doctrine/orm": "2.7.*"
	},
	"config": {
		"allow-plugins": {
			"composer/package-versions-deprecated": true
		}
	}
}

Output of composer diagnose:

Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.2.0
PHP version: 7.4.25
PHP binary path: /usr/bin/php7.4
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019
cURL version: 7.52.1 libz 1.2.8 ssl OpenSSL/1.0.2u
zip: extension present, unzip not available, 7-Zip present (7z)

When I run this command:

php composer.phar install

I get the following output:

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
Updating dependencies
Lock file operations: 25 installs, 0 updates, 0 removals
  - Locking composer/package-versions-deprecated (1.11.99.4)
  - Locking doctrine/annotations (1.13.2)
  - Locking doctrine/cache (1.12.1)
  - Locking doctrine/collections (1.6.8)
  - Locking doctrine/common (3.2.0)
  - Locking doctrine/dbal (2.13.6)
  - Locking doctrine/deprecations (v0.5.3)
  - Locking doctrine/event-manager (1.1.1)
  - Locking doctrine/inflector (1.4.4)
  - Locking doctrine/instantiator (1.4.0)
  - Locking doctrine/lexer (1.2.1)
  - Locking doctrine/orm (2.7.5)
  - Locking doctrine/persistence (2.2.3)
  - Locking psr/cache (1.0.1)
  - Locking psr/container (1.1.2)
  - Locking symfony/console (v5.4.1)
  - Locking symfony/deprecation-contracts (v2.5.0)
  - Locking symfony/polyfill-ctype (v1.23.0)
  - Locking symfony/polyfill-intl-grapheme (v1.23.1)
  - Locking symfony/polyfill-intl-normalizer (v1.23.0)
  - Locking symfony/polyfill-mbstring (v1.23.1)
  - Locking symfony/polyfill-php73 (v1.23.0)
  - Locking symfony/polyfill-php80 (v1.23.1)
  - Locking symfony/service-contracts (v2.5.0)
  - Locking symfony/string (v5.4.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 25 installs, 0 updates, 0 removals
  - Installing composer/package-versions-deprecated (1.11.99.4): Extracting archive
PHP Fatal error:  Uncaught Error: Class 'Symfony\Component\HttpKernel\Kernel' not found in /var/www/auxmoney-web/thiago/app/AppKernel.php:5
Stack trace:
#0 phar:///var/www/auxmoney-web/thiago/composer.phar/src/Composer/Autoload/AutoloadGenerator.php(1422): require()
#1 phar:///var/www/auxmoney-web/thiago/composer.phar/src/Composer/Plugin/PluginManager.php(249): Composer\Autoload\composerRequire('af17a070b6916a0...', 'app/AppKernel.p...')
#2 phar:///var/www/auxmoney-web/thiago/composer.phar/src/Composer/Installer/PluginInstaller.php(79): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
#3 [internal function]: Composer\Installer\PluginInstaller->Composer\Installer\{closure}(NULL)
#4 phar:///var/www/auxmoney-web/thiago/composer.phar/vendor/react/promise/src/React/Promise/FulfilledPromise.php(20): call_user_func(Object(Closure), NULL)
#5 phar:///var/www/auxmoney-web/thiago/composer.phar/vendor/react/promise/src/React/Promise/Deferred.php(74): React\Promise\FulfilledPromise->then(Object in /var/www/auxmoney-web/thiago/app/AppKernel.php on line 5

Fatal error: Uncaught Error: Class 'Symfony\Component\HttpKernel\Kernel' not found in /var/www/auxmoney-web/thiago/app/AppKernel.php:5
Stack trace:
#0 phar:///var/www/auxmoney-web/thiago/composer.phar/src/Composer/Autoload/AutoloadGenerator.php(1422): require()
#1 phar:///var/www/auxmoney-web/thiago/composer.phar/src/Composer/Plugin/PluginManager.php(249): Composer\Autoload\composerRequire('af17a070b6916a0...', 'app/AppKernel.p...')
#2 phar:///var/www/auxmoney-web/thiago/composer.phar/src/Composer/Installer/PluginInstaller.php(79): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
#3 [internal function]: Composer\Installer\PluginInstaller->Composer\Installer\{closure}(NULL)
#4 phar:///var/www/auxmoney-web/thiago/composer.phar/vendor/react/promise/src/React/Promise/FulfilledPromise.php(20): call_user_func(Object(Closure), NULL)
#5 phar:///var/www/auxmoney-web/thiago/composer.phar/vendor/react/promise/src/React/Promise/Deferred.php(74): React\Promise\FulfilledPromise->then(Object in /var/www/auxmoney-web/thiago/app/AppKernel.php on line 5

And I expected this to happen: No error.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

2.2.1 is out now with the fix.

I gotta ask though, seeing #10383 and #10384 and this issue here… where were you all when we asked to test 2.2.0-RC1? 🤨

I see the same problem happening. ~I think it’s because https://github.com/composer/composer/pull/10065 is now loading the files before the ClassLoader is hooked into the autoload functionality.~ edit: nvm, https://github.com/composer/composer/pull/10279 fixed that. @thiagorb We added composer self-update 2.1.14 in our scripts before doing composer install.