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

Error when upgrading to v2.0.0 (Cannot assign Pyrech\ComposerChangelogs\Config\Config to property) #81

Open
adrenth opened this issue Feb 7, 2023 · 4 comments

Comments

@adrenth
Copy link

adrenth commented Feb 7, 2023

  • PHP v8.2
  • Composer v2.5.2

When having v1.8.2 installed and upgrading to v2.0.0 you might get this error:

  - Upgrading pyrech/composer-changelogs (v1.8.2 => v2.0.0): Extracting archive
    Update of pyrech/composer-changelogs failed

In PluginManager.php(274) : eval()'d code line 111:
                                                                                                                                                         
  [TypeError]                                                                                                                                            
  Cannot assign Pyrech\ComposerChangelogs\Config\Config to property Pyrech\ComposerChangelogs\ChangelogsPlugin_composer_tmp0::$config of type ?Pyrech\C  
  omposerChangelogs\Model\Config                

After clearing composer cache it should work fine.

$ composer clear-cache

...

$ composer update

...

Changelogs summary:

 - pyrech/composer-changelogs updated from v1.8.2 to v2.0.0 major
   See changes: https://github.com/pyrech/composer-changelogs/compare/v1.8.2...v2.0.0
   Release notes: https://github.com/pyrech/composer-changelogs/releases/tag/v2.0.0

However... can this behavior be prevented? Anyone else experienced this issue?

@pyrech
Copy link
Owner

pyrech commented Feb 7, 2023

Hi @adrenth

I released v2 a few days ago so you might be the first to experience this issue. Sorry for that.

I guess this is due to some class that were renamed but Composer keep some cache for each plugin. I will try to reproduce the issue and fix it asap.

Thanks

@EPGDigital-MW
Copy link

EPGDigital-MW commented Mar 6, 2023

Can confirm clear-cache fixed this for me too

PHP Fatal error:  Uncaught TypeError: Typed property Pyrech\ComposerChangelogs\ChangelogsPlugin_composer_tmp0::$config must be an instance of Pyrech\ComposerChangelogs\Model\Config or null, Pyrech\ComposerChangelogs\Config\Config used in phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(221) : eval()'d code:111
Stack trace:
#0 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(221) : eval()'d code(41): Pyrech\ComposerChangelogs\ChangelogsPlugin_composer_tmp0->setupConfig()
#1 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(345): Pyrech\ComposerChangelogs\ChangelogsPlugin_composer_tmp0->activate()
#2 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(233): Composer\Plugin\PluginManager->addPlugin()
#3 phar:///usr/bin/composer/src/Composer/Installer/PluginInstaller.php(103): Composer\Plugin\PluginManager->registerPackage()
#4 [internal function]: Composer\Installer\PluginInstaller->Composer\Installer\{closure}()
#5 phar:///usr/bin/composer/vendor/react/promise/src/React/Promise in phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(221) : eval()'d code on line 111

Fatal error: Uncaught TypeError: Typed property Pyrech\ComposerChangelogs\ChangelogsPlugin_composer_tmp0::$config must be an instance of Pyrech\ComposerChangelogs\Model\Config or null, Pyrech\ComposerChangelogs\Config\Config used in phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(221) : eval()'d code:111
Stack trace:
#0 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(221) : eval()'d code(41): Pyrech\ComposerChangelogs\ChangelogsPlugin_composer_tmp0->setupConfig()
#1 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(345): Pyrech\ComposerChangelogs\ChangelogsPlugin_composer_tmp0->activate()
#2 phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(233): Composer\Plugin\PluginManager->addPlugin()
#3 phar:///usr/bin/composer/src/Composer/Installer/PluginInstaller.php(103): Composer\Plugin\PluginManager->registerPackage()
#4 [internal function]: Composer\Installer\PluginInstaller->Composer\Installer\{closure}()
#5 phar:///usr/bin/composer/vendor/react/promise/src/React/Promise in phar:///usr/bin/composer/src/Composer/Plugin/PluginManager.php(221) : eval()'d code on line 111
➜`

@NicolasCARPi
Copy link

@pyrech Maybe adding a note about it in the CHANGELOG would be enough. It's a simple fix once you know what to do.

@pyrech
Copy link
Owner

pyrech commented Mar 8, 2023

Sorry I did not find some time to dig this issue yet.

@NicolasCARPi You're right, thanks for the suggestion, I just added a note in the CHANGELOG.md and the GitHub release

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

No branches or pull requests

4 participants