composer-patches icon indicating copy to clipboard operation
composer-patches copied to clipboard

Composer Snapshot and 1.7.1 not compatible

Open PhilETaylor opened this issue 3 years ago • 2 comments

After installing cweagans/composer-patches 1.7.1 when running Composer Snapshot 575fbfb53fcc2388916d554271c99c8281fea782 and then running composer update I get the following error.

When downgrading to Composer 2.2.7 Stable the error is resolved - so a future issue to come soon :)

(Don't be confused by the 2.2.7 in the home-brew folder names - Ive used composer selfup --snapshot in that place)

PHP 8.1.2

PHP Fatal error:  Uncaught TypeError: Composer\EventDispatcher\EventDispatcher::dispatch(): Argument #1 ($eventName) must be of type string, null given, called in /Users/phil/Sites/worker.mysites.guru/vendor/cweagans/composer-patches/src/Patches.php on line 318 and defined in phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:99
Stack trace:
#0 /Users/phil/Sites/worker.mysites.guru/vendor/cweagans/composer-patches/src/Patches.php(318): Composer\EventDispatcher\EventDispatcher->dispatch(NULL, Object(cweagans\Composer\PatchEvent))
#1 [internal function]: cweagans\Composer\Patches->postInstall(Object(Composer\Installer\PackageEvent))
#2 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(199): call_user_func(Array, Object(Composer\Installer\PackageEvent))
#3 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(141): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Installer\PackageEvent))
#4 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(460): Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent('post-package-in...', true, Object(Composer\Repository\InstalledFilesystemRepository), Array, Object(Composer\DependencyResolver\Operation\InstallOperation))
#5 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(475): Composer\Installer\InstallationManager->Composer\Installer\{closure}()
#6 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(390): Composer\Installer\InstallationManager->executeBatch(Object(Composer\Repository\InstalledFilesystemRepository), Array, Array, true, true, Array)
#7 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(282): Composer\Installer\InstallationManager->downloadAndExecuteBatch(Object(Composer\Repository\InstalledFilesystemRepository), Array, Array, true, true, Array)
#8 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer.php(754): Composer\Installer\InstallationManager->execute(Object(Composer\Repository\InstalledFilesystemRepository), Array, true, true)
#9 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer.php(583): Composer\Installer->doInstall(Object(Composer\Repository\InstalledFilesystemRepository), true)
#10 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer.php(279): Composer\Installer->doUpdate(Object(Composer\Repository\InstalledFilesystemRepository), true)
#11 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Command/UpdateCommand.php(241): Composer\Installer->run()
#12 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Command/Command.php(298): Composer\Command\UpdateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Application.php(1015): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Composer\Command\UpdateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Console/Application.php(332): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Console/Application.php(128): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/bin/composer(83): Composer\Console\Application->run()
#19 /usr/local/Cellar/composer/2.2.7/bin/composer(30): require('phar:///usr/loc...')
#20 {main}
  thrown in phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php on line 99

Fatal error: Uncaught TypeError: Composer\EventDispatcher\EventDispatcher::dispatch(): Argument #1 ($eventName) must be of type string, null given, called in /Users/phil/Sites/worker.mysites.guru/vendor/cweagans/composer-patches/src/Patches.php on line 318 and defined in phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:99
Stack trace:
#0 /Users/phil/Sites/worker.mysites.guru/vendor/cweagans/composer-patches/src/Patches.php(318): Composer\EventDispatcher\EventDispatcher->dispatch(NULL, Object(cweagans\Composer\PatchEvent))
#1 [internal function]: cweagans\Composer\Patches->postInstall(Object(Composer\Installer\PackageEvent))
#2 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(199): call_user_func(Array, Object(Composer\Installer\PackageEvent))
#3 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(141): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Installer\PackageEvent))
#4 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(460): Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent('post-package-in...', true, Object(Composer\Repository\InstalledFilesystemRepository), Array, Object(Composer\DependencyResolver\Operation\InstallOperation))
#5 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(475): Composer\Installer\InstallationManager->Composer\Installer\{closure}()
#6 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(390): Composer\Installer\InstallationManager->executeBatch(Object(Composer\Repository\InstalledFilesystemRepository), Array, Array, true, true, Array)
#7 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer/InstallationManager.php(282): Composer\Installer\InstallationManager->downloadAndExecuteBatch(Object(Composer\Repository\InstalledFilesystemRepository), Array, Array, true, true, Array)
#8 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer.php(754): Composer\Installer\InstallationManager->execute(Object(Composer\Repository\InstalledFilesystemRepository), Array, true, true)
#9 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer.php(583): Composer\Installer->doInstall(Object(Composer\Repository\InstalledFilesystemRepository), true)
#10 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Installer.php(279): Composer\Installer->doUpdate(Object(Composer\Repository\InstalledFilesystemRepository), true)
#11 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Command/UpdateCommand.php(241): Composer\Installer->run()
#12 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Command/Command.php(298): Composer\Command\UpdateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Application.php(1015): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Composer\Command\UpdateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Console/Application.php(332): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/Console/Application.php(128): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 phar:///usr/local/Cellar/composer/2.2.7/bin/composer/bin/composer(83): Composer\Console\Application->run()
#19 /usr/local/Cellar/composer/2.2.7/bin/composer(30): require('phar:///usr/loc...')
#20 {main}
  thrown in phar:///usr/local/Cellar/composer/2.2.7/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php on line 99

PhilETaylor avatar Mar 02 '22 20:03 PhilETaylor

@Seldaek - one of my early warning Snapshot tests - sorry.

PhilETaylor avatar Mar 02 '22 20:03 PhilETaylor

@PhilETaylor no worries, thanks for spotting. https://github.com/composer/composer/commit/906692cd049b9c372e91f9433337962a5253b260 should fix this I hope :)

Seldaek avatar Mar 29 '22 19:03 Seldaek

@PhilETaylor Is your early-warning snapshot test available somewhere? I'd be interested in adding something like that to this plugin directly.

I think this is resolved now, but please let me know if that's not the case.

cweagans avatar Feb 07 '23 22:02 cweagans

by "snapshot" I mean the very very latest version of composer from the snapshot channel

$ composer selfup --snapshot 
You are already using the latest available Composer version 7499d9365353f28d095698dc90ba3e976ebfb612 (snapshot channel).

I update on my local machine to the latest snapshot of composer each morning and use that - unless it's broken that day, which then I downgrade to the stable version for that day.

I dont use composer-patches any longer though as I dont have any patch files to apply currently.

PhilETaylor avatar Feb 07 '23 22:02 PhilETaylor

looks fine at the moment for me - thanks

~/Sites take deleteme
~/Sites/deleteme cr  cweagans/composer-patches
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been created
Running composer update cweagans/composer-patches
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking cweagans/composer-patches (1.7.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Downloading cweagans/composer-patches (1.7.3)
cweagans/composer-patches contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "cweagans/composer-patches" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?] y
  - Installing cweagans/composer-patches (1.7.3): Extracting archive
Generating autoload files
No security vulnerability advisories found
Using version ^1.7 for cweagans/composer-patches
~/Sites/deleteme ls
composer.json composer.lock vendor
~/Sites/deleteme composer selfup --snapshot
You are already using the latest available Composer version 7499d9365353f28d095698dc90ba3e976ebfb612 (snapshot channel).
~/Sites/deleteme composer update
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
No security vulnerability advisories found

PhilETaylor avatar Feb 07 '23 22:02 PhilETaylor