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

Version information not yet available in scripts for post-update-cmd and post-install-cmd #9457

Closed
frankvanhest opened this issue Nov 9, 2020 · 6 comments
Labels
Milestone

Comments

@frankvanhest
Copy link

Hi there,

After discussing the issue Roave/you-are-using-it-wrong#95 it seems that the package version is not yet available when running scripts for post-update-cmd and post-install-cmd.
I'm using composer v2.0.6.

I don't know if this is the correct repo for this issue. It was suggested in the original issue mentioned before.

Thank you in advance and it you need more information, let me know.

Cheers, Frank

@adamturcsan
Copy link

I've done a little debugging as I'm also affected by this bug.

I don't really know the mechanism of this package, but while this https://github.com/composer/package-versions-deprecated/blob/c8c9aa8a14cc3d3bec86d0a8c3fa52ea79936855/src/PackageVersions/Installer.php#L103 evaluates to true and it tries to get the version through InstalledVersions::get* getters (and fails) the self::VERSIONS constant contains the searched package info so it is clearly there.

It's just my 2 cents, I thought this disparity might be a lead to investigate.

@adamturcsan
Copy link

Further investigations revealed that due to composer 2.0 implementing the InstalledVersion class itself the InstalledVersion class it uses at runtime is not the same that is generated after install by this package, but the one which is in the composer phar.

@Seldaek Seldaek transferred this issue from composer/package-versions-deprecated Nov 11, 2020
@Seldaek Seldaek added this to the 2.0 milestone Nov 11, 2020
@Seldaek Seldaek added the Bug label Nov 11, 2020
@Seldaek
Copy link
Member

Seldaek commented Nov 11, 2020

Indeed @adamturcsan the data was not available at runtime, which was an oversight. It was thought of to be used by the project and not by plugins, but plugins are also a valid use case for sure. Please confirm it works with composer self-update --snapshot

@frankvanhest
Copy link
Author

@Seldaek and @adamturcsan Thank you both for your time and effort. I can confirm the correct installed versions are now used.

@adamturcsan
Copy link

@Seldaek Thanks for the rapid action! It works for me too :)

@asgrim
Copy link
Contributor

asgrim commented Nov 11, 2020

thank you @Seldaek $:tumbler_glass:++

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

No branches or pull requests

4 participants