TYPO3 / CmsComposerInstallers

TYPO3 CMS Composer Installer
GNU General Public License v2.0
58 stars 39 forks source link

1.5.7 broke on older composer versions due to Undefined class constant 'RUNTIME_API_VERSION' #105

Closed DanielSiepmann closed 3 years ago

DanielSiepmann commented 3 years ago

With update from 1.5.6 to 1.5.7 we receive the following PHP Fatal error in our CIs. Those CIs still run an older Composer 1.x version. In case you need the concrete version, I can look it up.

Updating dependencies (including require-dev)
Package operations: 99 installs, 0 updates, 0 removals
  - Installing typo3/cms-composer-installers (v1.5.7): Downloading (100%)
PHP Fatal error:  Uncaught Error: Undefined class constant 'RUNTIME_API_VERSION' in /srv/project/vendor/typo3/cms-composer-installers/src/Installer/Plugin.php:86
Stack trace:

Fatal error: Uncaught Error: Undefined class constant 'RUNTIME_API_VERSION' in /srv/project/vendor/typo3/cms-composer-installers/src/Installer/Plugin.php:86
Stack trace:
#0 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(237): TYPO3\CMS\Composer\Installer\Plugin->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#0 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(237): TYPO3\CMS\Composer\Installer\Plugin->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(206): Composer\Plugin\PluginManager->addPlugin(Object(TYPO3\CMS\Composer\Installer\Plugin))
#1 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(206): Composer\Plugin\PluginManager->addPlugin(Object(TYPO3\CMS\Composer\Installer\Plugin))
#2 phar:///usr/bin/composer/src/Composer/Installer/PluginInstaller.php(62): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
#2 phar:///usr/bin/composer/src/Composer/Installer/PluginInstaller.php(62): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage), true)
#3 phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\CompletePackage))
#4 phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php(160): Composer\Installer\InstallationManager->install(Object( in /srv/project/vendor/typo3/cms-composer-installers/src/Installer/Plugin.php on line 86
#3 phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php(173): Composer\Installer\PluginInstaller->install(Object(Composer\Repository\InstalledFilesystemRepository), Object(Composer\Package\CompletePackage))
#4 phar:///usr/bin/composer/src/Composer/Installer/InstallationManager.php(160): Composer\Installer\InstallationManager->install(Object( in /srv/project/vendor/typo3/cms-composer-installers/src/Installer/Plugin.php on line 86
0
DanielSiepmann commented 3 years ago

I guess the package just doesn't support older versions and requires at least composer 1.10.6, so not an actual bug here in the package, but one should update composer. Will close the issue.

benjaminkott commented 3 years ago

@DanielSiepmann will check

DanielSiepmann commented 3 years ago

Just for information, the commits introducing the constant: 2.x: https://github.com/composer/composer/commit/0ab48a1773e55ee1706d43e739fa5719811a87c8 1.x: https://github.com/composer/composer/commit/ff05150c4e1514c452be03b86974fbc891942156

benjaminkott commented 3 years ago

did not notice that it was introduced lately - only checked if it´s available - I am sorry. but we could switch to PLUGIN_API_VERSION, that was introduced 5 years ago https://github.com/composer/composer/blob/1.10/src/Composer/Plugin/PluginInterface.php#L30

We just need a reliable check if were on v1 or v2 for the compact layers. Will provide patches.

DanielSiepmann commented 3 years ago

I don't think that's necessary. I would expect everyone to run on latest 1.x or 2.x anyway. But nice to hear you wanna patch that. One could also just check for existence of the constant. If it is not available it is 1.x.

benjaminkott commented 3 years ago

yeah maybe the better option here, will provide patches - I broke it.

benjaminkott commented 3 years ago

@DanielSiepmann please check prs

DanielSiepmann commented 3 years ago

Looks good to me, thanks for providing the patches.