nanobox-io/nanobox-engine-php

php-7.0 runtime try to use composer 1.6.4, but only works with php-7.1

Opened this issue · 1 comments

Error when I try use nanobox run

PHP 7.0

Boxfile

    runtime: php-7.0

nanobox run ERROR 😢

    - composer install :
      
      Fatal error: Uncaught TypeError: Return value of PackageVersions\Installer::activate() must be an instance of PackageVersions\void, none returned in /app/vendor/ocramius/package-versions/src/PackageVersions/Installer.php:62
      Stack trace:
      #0 phar:///data/bin/composer/src/Composer/Plugin/PluginManager.php(236): PackageVersions\Installer->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
      #1 phar:///data/bin/composer/src/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(PackageVersions\Installer))
      #2 phar:///data/bin/composer/src/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
      #3 phar:///data/bin/composer/src/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
      #4 phar:///data/bin/composer/src/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
      #5 phar:///data/bin/composer/sr in /app/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 62

PHP 7.1

Boxfile

    runtime: php-7.1

nanobox run OK 😄

More information

  • Also, I try with composer require and require-dev empty
  • Maybe its related with Ocramius/PackageVersions#18, but php-7.1 runtime requieres an update on nanobox images server, I think.

It's a bug related cache_dir. This is how can I reproduce the error.

pablorsk $ cat boxfile.yml | grep runtime
    runtime: php-7.1
pablorsk $ nanobox run
/app $ composer install # all its ok
/app $ exit
pablorsk $ git checkout some_branch_with_php70
pablorsk $ cat boxfile.yml | grep runtime
    runtime: php-7.0
pablorsk $ nanobox run
# CRASH !!!

Only solution is nanobox destroy (or, more complex, do inside machine rm -rf vendor/*)

This problem can be solved, maybe, with #84. And prevent another issues like #100. Is not related with composer version. Nanobox uses allways (for now) 1.6.3 version.