Skip to content

Avoid errors with an older global install of Flex#976

Merged
fabpot merged 1 commit intosymfony:2.xfrom
weaverryan:protecting-against-older-versions
May 27, 2023
Merged

Avoid errors with an older global install of Flex#976
fabpot merged 1 commit intosymfony:2.xfrom
weaverryan:protecting-against-older-versions

Conversation

@weaverryan
Copy link
Copy Markdown
Contributor

Hi!

When I tried 2.3.0 locally, I it exploded, complaining about:

Call to undefined method Symfony\Flex\Configurator::postInstall()
The reason is that I have a global symfony/flex install, which was NOT on 2.3.0. And so... I guess (?) your global symfony/flex is used when originally creating a new project / installing symfony/flex into a project... at least partially? It's a bit opaque to me, but this may be needed to avoid issues.

Btw, the fix for this is running composer global up symfony/flex.

@fabpot
Copy link
Copy Markdown
Member

fabpot commented May 27, 2023

Thank you @weaverryan.

@fabpot fabpot merged commit 3c9c342 into symfony:2.x May 27, 2023
@weaverryan weaverryan deleted the protecting-against-older-versions branch May 29, 2023 01:08
fabpot added a commit that referenced this pull request Oct 22, 2023
…aded (weaverryan)

This PR was squashed before being merged into the 1.x branch.

Discussion
----------

[Bug] Fix Flex not installing recipes while it is being upgraded

Fixes #977

Here's the lifecycle:

A) Packages are installed/updated and `Flex::recordOperations()` is called.
B) Composer sees that `symfony/flex` is updated and unloads the plugin and reloads it under a new `Symfony\Flex\Flex_composer_tmp0` class. This results in the `Flex::$operations` property being lost.
C) And so, no recipes are installed.

This PR "stashes" the operations directly on `Symfony/Flex/Flex` where we then read them later. Tested locally. Amazing, it seems to work perfectly.

Also, backports #976 to 1.x - my fault for making the PR on the wrong branch.

Cheers!

Commits
-------

62f7874 [Bug] Fix Flex not installing recipes while it is being upgraded
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

Successfully merging this pull request may close these issues.

2 participants