Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When upgrading from 0.15 to 0.16, composer plugin spits out some errors #672

Closed
jaydiablo opened this issue Sep 9, 2019 · 2 comments
Closed

Comments

@jaydiablo
Copy link

Q A
Version 0.16.0
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets

I noticed this when upgrading from 0.15 to 0.16. When I run composer update after changing the dependency to allow 0.16, I get this fatal error during the composer update:

  - Updating phpro/grumphp (v0.15.2 => v0.16.0): Loading from cache
Writing lock file
Generating autoload files
PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function GrumPHP\Locator\ExternalCommand::__construct(), 2 passed in vendor/phpro/grumphp/src/Composer/GrumPHPPlugin.php on line 165 and exactly 3 expected in vendor/phpro/grumphp/src/Locator/ExternalCommand.php:29
Stack trace:
#0 vendor/phpro/grumphp/src/Composer/GrumPHPPlugin.php(165): GrumPHP\Locator\ExternalCommand->__construct('...', Object(Symfony\Component\Process\ExecutableFinder))
#1 vendor/phpro/grumphp/src/Composer/GrumPHPPlugin.php(131): GrumPHP\Composer\GrumPHPPlugin->runGrumPhpCommand('configure')
#2 [internal function]: GrumPHP\Composer\GrumPHPPlugin->runScheduledTasks(Object(Composer\Script\Event))
#3 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(Composer\Script\Event))
#4 phar:///usr/local/bin/composer/src/Composer/Even in /Volumes/GitWorkspace/Sites/zf1-acl/vendor/phpro/grumphp/src/Locator/ExternalCommand.php on line 29

Subsequent composer update calls don't show this error, it seems to only happen on the initial change from one version to the other.

I can reliably make the error show by just downgrading the package, and then upgrading it again (only shows on the composer update when upgrading). FWIW, it does happen when upgrading from 0.14 as well.

php -v
PHP 7.2.19 (cli) (built: Jun 17 2019 09:03:55) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.19, Copyright (c) 1999-2018, by Zend Technologies
@veewee
Copy link
Contributor

veewee commented Sep 10, 2019

That is indeed a terrible upgrade experience.

The problem here is that composer loads the old version of the plugin, but requires the new versions of the files after the installation.
Flex fixes it by loading all classes manually during plugin activation.
https://github.com/symfony/flex/blob/master/src/Flex.php#L97-L103

Re-writing the plugin for grumphp-shim and to fix some small issues is high up in my todo list, but I haven't come around of doing it yet.

Will add the workaround somewhere this week and tag 0.16.1 for it.

@veewee
Copy link
Contributor

veewee commented Nov 29, 2019

Fixed in 0.17.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants